From: David ‘Bombe’ Roden Date: Fri, 1 Mar 2013 06:21:11 +0000 (+0100) Subject: Put HTML generation into its own method. X-Git-Tag: v2~305 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=a9465123443368cb7313468c38865e03ddb9d8fe;p=rhynodge.git Put HTML generation into its own method. --- diff --git a/src/main/java/net/pterodactylus/rhynodge/triggers/NewComicTrigger.java b/src/main/java/net/pterodactylus/rhynodge/triggers/NewComicTrigger.java index 45c290f..1b64c5b 100644 --- a/src/main/java/net/pterodactylus/rhynodge/triggers/NewComicTrigger.java +++ b/src/main/java/net/pterodactylus/rhynodge/triggers/NewComicTrigger.java @@ -121,16 +121,28 @@ public class NewComicTrigger implements Trigger { html.append(""); for (Comic newComic : newComics) { - html.append("

").append(StringEscapeUtils.escapeHtml4(newComic.title())).append("

\n"); - for (Strip strip : newComic) { - html.append("
\"").append(StringEscapeUtils.escapeHtml4(strip.comment()));
\n"); - } + generateComicHtml(html, newComic); } return html.append("").toString(); } + /** + * Generates the HTML for a single comic. + * + * @param html + * The string builder to append the HTML to + * @param comic + * The comic to render + */ + private void generateComicHtml(StringBuilder html, Comic comic) { + html.append("

").append(StringEscapeUtils.escapeHtml4(comic.title())).append("

\n"); + for (Strip strip : comic) { + html.append("
\"").append(StringEscapeUtils.escapeHtml4(strip.comment()));
\n"); + } + } + }