X-Git-Url: http://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fpnews%2FHTML.java;h=78d584d6e8fc179220f388e6e8230684920f4dbe;hb=78b4da5fea99561e7707e6de5195ae1c693193ae;hp=5f089cc3e6d312f404ec8ade28d766356aa08278;hpb=abd88d90605e6a3292ea2c778ec962303c1f5bc8;p=pnews.git diff --git a/src/main/java/pnews/HTML.java b/src/main/java/pnews/HTML.java index 5f089cc..78d584d 100644 --- a/src/main/java/pnews/HTML.java +++ b/src/main/java/pnews/HTML.java @@ -3,10 +3,16 @@ package pnews; import java.util.List; public class HTML { - private static void appendA(StringBuffer buf, String child, String href) { + private static void appendA(StringBuffer buf, String child, String href, String cl) { buf.append(""); + buf.append("'"); + if (cl != null) { + buf.append(" class='"); + buf.append(cl); + buf.append('\''); + } + buf.append('>'); buf.append(child); buf.append(""); } @@ -24,31 +30,43 @@ public class HTML { } private static void append(StringBuffer buf, Article a) { - buf.append("
\n"); + buf.append("
\n"); + buf.append("

"); - appendA(buf, a.title, a.link); + if (a.thumbnail != null) { + buf.append("\n"); + } + appendA(buf, a.title, a.link, null); buf.append("

\n"); - - buf.append("\n"); - buf.append("

" + a.website + " - " + a.publicationDate + "

"); + buf.append(""); - buf.append("

"); - buf.append(a.description); - buf.append("

"); + if (a.description != null) { + buf.append("

"); + buf.append(a.description); + buf.append("

"); + } - buf.append("
\n"); + buf.append("\n"); } - private static void appendMenu(StringBuffer buf) { + private static void appendMenu(StringBuffer buf, Category catActive) { + String cl; + buf.append("\n"); } - public static String toHTML(List
articles) { + public static String toHTML(List
articles, Category catActive) { StringBuffer buf; buf = new StringBuffer(); @@ -69,7 +87,7 @@ public class HTML { buf.append("\n"); buf.append("\n"); - appendMenu(buf); + appendMenu(buf, catActive); for (Article e: articles) append(buf, e);