From 0dc51d8768cba03ecff82a5c0dc8c7ece695af6b Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 5 Jan 2018 12:48:04 +0300 Subject: formatHtml --- .../src/main/java/com/juick/util/MessageUtils.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'juick-core') diff --git a/juick-core/src/main/java/com/juick/util/MessageUtils.java b/juick-core/src/main/java/com/juick/util/MessageUtils.java index 03b677d4..91cc7870 100644 --- a/juick-core/src/main/java/com/juick/util/MessageUtils.java +++ b/juick-core/src/main/java/com/juick/util/MessageUtils.java @@ -143,6 +143,33 @@ public class MessageUtils { return msg; } + public static String formatHtml(Message jmsg) { + StringBuilder sb = new StringBuilder(); + boolean isReply = jmsg.getRid() > 0; + String title = isReply ? "
" + jmsg.getReplyQuote() + "" : "" + jmsg.getTagsString() + ""; + boolean isCode = jmsg.getTags().stream().anyMatch(t -> t.getName().equals("code")); + + sb.append(title).append(jmsg.getUser().getName()).append(":