aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/formatters
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/formatters')
-rw-r--r--src/main/java/com/juick/formatters/PlainTextFormatter.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/com/juick/formatters/PlainTextFormatter.java b/src/main/java/com/juick/formatters/PlainTextFormatter.java
index 378a523f7..41d24e931 100644
--- a/src/main/java/com/juick/formatters/PlainTextFormatter.java
+++ b/src/main/java/com/juick/formatters/PlainTextFormatter.java
@@ -57,7 +57,7 @@ public class PlainTextFormatter {
public static String formatPostSummary(Message m) {
int cropLength = 384;
- String timeAgo = pt.format(Date.from(m.getTimestamp()));
+ String timeAgo = pt.format(Date.from(m.getCreated()));
String repliesCount = m.getReplies() == 1 ? "; 1 reply" : m.getReplies() == 0 ? ""
: String.format("; %d replies", m.getReplies());
StringBuilder sb = new StringBuilder();
@@ -84,6 +84,14 @@ public class PlainTextFormatter {
return "https://juick.com/m/" + jmsg.getMid();
}
+ public static String markdownUrl(String url, String description) {
+ if (StringUtils.isNotBlank(description)) {
+ return String.format("[%s](%s)", description, url);
+ } else {
+ return url;
+ }
+ }
+
public static String formatPostNumber(com.juick.Message jmsg) {
if (jmsg.getRid() > 0) {
return String.format("%d/%d", jmsg.getMid(), jmsg.getRid());