projects
/
asciidoctor_to_rss.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
improved structure
[asciidoctor_to_rss.git]
/
src
/
main
/
java
/
net
/
wpitchoune
/
asciidoctor
/
HTML.java
diff --git
a/src/main/java/net/wpitchoune/asciidoctor/HTML.java
b/src/main/java/net/wpitchoune/asciidoctor/HTML.java
index
63588a7
..
8c3bc0b
100644
(file)
--- a/
src/main/java/net/wpitchoune/asciidoctor/HTML.java
+++ b/
src/main/java/net/wpitchoune/asciidoctor/HTML.java
@@
-106,6
+106,32
@@
public final class HTML {
return buf.toString();
}
return buf.toString();
}
+ private static void appendStartTag(StringBuffer buf, String tag, int indent, boolean newline) {
+ while (indent > 0) {
+ buf.append('\t');
+ indent--;
+ }
+ buf.append('<');
+ buf.append(tag);
+ buf.append(">");
+
+ if (newline)
+ buf.append('\n');
+ }
+
+ private static void appendEndTag(StringBuffer buf, String tag, int indent, boolean newline) {
+ while (indent > 0) {
+ buf.append('\t');
+ indent--;
+ }
+ buf.append("</");
+ buf.append(tag);
+ buf.append(">");
+
+ if (newline)
+ buf.append('\n');
+ }
+
public String toHTML(Collection<SyndEntry> entries) throws IOException {
StringBuffer buf;
List<SyndEntry> sortedEntries;
public String toHTML(Collection<SyndEntry> entries) throws IOException {
StringBuffer buf;
List<SyndEntry> sortedEntries;
@@
-115,7
+141,7
@@
public final class HTML {
appendHTMLHead(buf, config.getFeedTitle());
appendHTMLHead(buf, config.getFeedTitle());
-
buf.append("<body>\n"
);
+
appendStartTag(buf, "body", 1, true
);
appendHTMLContentHeader(buf, config.getFeedTitle());
appendHTMLContentHeader(buf, config.getFeedTitle());
@@
-132,18
+158,25
@@
public final class HTML {
Collections.sort(sortedEntries, cmp);
for(SyndEntry e: sortedEntries) {
Collections.sort(sortedEntries, cmp);
for(SyndEntry e: sortedEntries) {
- buf.append("\n<div>");
- buf.append("<h2>");
+ appendStartTag(buf, "article", 3, true);
+ appendStartTag(buf, "header", 4, true);
+ appendStartTag(buf, "h1", 5, false);
buf.append("<a href='" + e.getUri() + "'>");
buf.append(e.getTitle());
buf.append("<a href='" + e.getUri() + "'>");
buf.append(e.getTitle());
- buf.append("</a></h2>");
+ buf.append("</a>");
+ appendEndTag(buf, "h1", 0, true);
+
if (e.getPublishedDate() != null) {
if (e.getPublishedDate() != null) {
- buf.append("<div class='date'>");
- buf.append(DATE_FORMATTER.format(e.getPublishedDate()));
- buf.append("</div>");
+ buf.append("<div class='date'>");
+ buf.append(DATE_FORMATTER.format(e.getPublishedDate()));
+ buf.append("</div>
\n
");
}
}
+
+ appendEndTag(buf, "header", 4, true);
+
buf.append(e.getDescription().getValue());
buf.append(e.getDescription().getValue());
- buf.append("</div>\n");
+
+ appendEndTag(buf, "article", 3, true);
}
buf.append("</div>\n");
}
buf.append("</div>\n");