@Test public void testResolveMarkdownForHtmlNoLinks() { String result = sut.resolveMarkdownForHtml("A&A [Link&1] (http: assertEquals("A&amp;A [Link&amp;1] (http: }
public String resolveMarkdownForHtml(final String input) { Matcher matcher = MARKDOWN_LINK_PATTERN.matcher(input); StringBuffer sb = new StringBuffer(); int copyFrom = 0; while (matcher.find()) { sb.append(StringEscapeUtils.escapeHtml(input.substring(copyFrom, matcher.start()))); copyFrom = matcher.end(); String text = matcher.group(1); String url = matcher.group(2); if (url.charAt(0) == '#') { url = baseUrl + url; } sb.append("<a href=\"").append(StringEscapeUtils.escapeHtml(url)).append("\">") .append(StringEscapeUtils.escapeHtml(text)).append("</a>"); } if (copyFrom > 0) { sb.append(StringEscapeUtils.escapeHtml(input.substring(copyFrom, input.length()))); return sb.toString(); } else { return StringEscapeUtils.escapeHtml(input); } }
NotificationMessageBuilderHelper { public String resolveMarkdownForHtml(final String input) { Matcher matcher = MARKDOWN_LINK_PATTERN.matcher(input); StringBuffer sb = new StringBuffer(); int copyFrom = 0; while (matcher.find()) { sb.append(StringEscapeUtils.escapeHtml(input.substring(copyFrom, matcher.start()))); copyFrom = matcher.end(); String text = matcher.group(1); String url = matcher.group(2); if (url.charAt(0) == '#') { url = baseUrl + url; } sb.append("<a href=\"").append(StringEscapeUtils.escapeHtml(url)).append("\">") .append(StringEscapeUtils.escapeHtml(text)).append("</a>"); } if (copyFrom > 0) { sb.append(StringEscapeUtils.escapeHtml(input.substring(copyFrom, input.length()))); return sb.toString(); } else { return StringEscapeUtils.escapeHtml(input); } } }
NotificationMessageBuilderHelper { public String resolveMarkdownForHtml(final String input) { Matcher matcher = MARKDOWN_LINK_PATTERN.matcher(input); StringBuffer sb = new StringBuffer(); int copyFrom = 0; while (matcher.find()) { sb.append(StringEscapeUtils.escapeHtml(input.substring(copyFrom, matcher.start()))); copyFrom = matcher.end(); String text = matcher.group(1); String url = matcher.group(2); if (url.charAt(0) == '#') { url = baseUrl + url; } sb.append("<a href=\"").append(StringEscapeUtils.escapeHtml(url)).append("\">") .append(StringEscapeUtils.escapeHtml(text)).append("</a>"); } if (copyFrom > 0) { sb.append(StringEscapeUtils.escapeHtml(input.substring(copyFrom, input.length()))); return sb.toString(); } else { return StringEscapeUtils.escapeHtml(input); } } NotificationMessageBuilderHelper(final String inBaseUrl); }
NotificationMessageBuilderHelper { public String resolveMarkdownForHtml(final String input) { Matcher matcher = MARKDOWN_LINK_PATTERN.matcher(input); StringBuffer sb = new StringBuffer(); int copyFrom = 0; while (matcher.find()) { sb.append(StringEscapeUtils.escapeHtml(input.substring(copyFrom, matcher.start()))); copyFrom = matcher.end(); String text = matcher.group(1); String url = matcher.group(2); if (url.charAt(0) == '#') { url = baseUrl + url; } sb.append("<a href=\"").append(StringEscapeUtils.escapeHtml(url)).append("\">") .append(StringEscapeUtils.escapeHtml(text)).append("</a>"); } if (copyFrom > 0) { sb.append(StringEscapeUtils.escapeHtml(input.substring(copyFrom, input.length()))); return sb.toString(); } else { return StringEscapeUtils.escapeHtml(input); } } NotificationMessageBuilderHelper(final String inBaseUrl); String resolveActivityBody(final ActivityDTO activity, final Context context); String cleanWhitespace(final String input); String resolveMarkdownForText(final String input); String resolveMarkdownForHtml(final String input); }
NotificationMessageBuilderHelper { public String resolveMarkdownForHtml(final String input) { Matcher matcher = MARKDOWN_LINK_PATTERN.matcher(input); StringBuffer sb = new StringBuffer(); int copyFrom = 0; while (matcher.find()) { sb.append(StringEscapeUtils.escapeHtml(input.substring(copyFrom, matcher.start()))); copyFrom = matcher.end(); String text = matcher.group(1); String url = matcher.group(2); if (url.charAt(0) == '#') { url = baseUrl + url; } sb.append("<a href=\"").append(StringEscapeUtils.escapeHtml(url)).append("\">") .append(StringEscapeUtils.escapeHtml(text)).append("</a>"); } if (copyFrom > 0) { sb.append(StringEscapeUtils.escapeHtml(input.substring(copyFrom, input.length()))); return sb.toString(); } else { return StringEscapeUtils.escapeHtml(input); } } NotificationMessageBuilderHelper(final String inBaseUrl); String resolveActivityBody(final ActivityDTO activity, final Context context); String cleanWhitespace(final String input); String resolveMarkdownForText(final String input); String resolveMarkdownForHtml(final String input);  }