private Function<Html, Option<Html>> renderContent(final StreamsEntry entry, final boolean truncate) { return c -> { Html description = truncate ? truncate(SUMMARY_LIMIT, c) : c; if (truncate && c.equals(description)) { return none(); // we don't want a summary if it will be the same as the content } Map<String, Object> context = ImmutableMap.<String, Object>builder(). put("contentHtml", description). put("truncated", truncate). put("isComment", isComment(entity)). put("contentUri", entry.getAlternateLink()). build(); return some(new Html(render(templateRenderer, "confluence-content-block.vm", context))); }; } };
public Option<Html> apply(Pair<Comment, Html> comment) { Html commentHtml = truncate ? truncate(SUMMARY_LIMIT, comment.second()) : comment.second(); if (truncate && comment.second().equals(commentHtml)) { return none(); // we don't want a summary if it will be the same as the content } Map<String, Object> context = ImmutableMap.<String, Object>builder(). put("contentHtml", commentHtml). put("truncated", truncate). put("contentUri", uriProvider.getIssueCommentUri(baseUri, comment.first())). build(); return some(new Html(render(templateRenderer, "jira-comment-block.vm", context))); } };