private void addNote(Rule rule, JsonWriter json) {
   RuleNote ruleNote = rule.ruleNote();
   if (ruleNote != null && !Strings.isNullOrEmpty(ruleNote.data())) {
     json.prop("noteRaw", ruleNote.data())
         .prop("noteHtml", Markdown.convertToHtml(ruleNote.data()));
   }
 }
Exemple #2
0
 private void writeComments(IssueQueryResult queryResult, Issue issue, JsonWriter json) {
   json.name("comments").beginArray();
   for (IssueComment comment : issue.comments()) {
     String userLogin = comment.userLogin();
     json.beginObject()
         .prop("key", comment.key())
         .prop("userName", userLogin != null ? queryResult.user(userLogin).name() : null)
         .prop("raw", comment.markdownText())
         .prop("html", Markdown.convertToHtml(comment.markdownText()))
         .prop("createdAt", DateUtils.formatDateTime(comment.createdAt()))
         .prop("fCreatedAge", formatAgeDate(comment.createdAt()))
         .prop(
             "updatable",
             UserSession.get().isLoggedIn()
                 && UserSession.get().login().equals(comment.userLogin()))
         .endObject();
   }
   json.endArray();
 }
Exemple #3
0
 public static String markdownToHtml(String input) {
   return Markdown.convertToHtml(input);
 }