"); + if (a.getDescription().length() < 512) { + buf.append(a.getDescription()); + } else { + buf.append(a.getDescription().substring(0, 512)); + buf.append("[..]"); + } + buf.append("
"); + } + buf.append("X-Git-Url: http://git.wpitchoune.net/gitweb/?p=pnews.git;a=blobdiff_plain;f=war%2Fsrc%2Fmain%2Fjava%2Fnet%2Fwpitchoune%2Fpnews%2Fservlet%2FHTML.java;fp=war%2Fsrc%2Fmain%2Fjava%2Fnet%2Fwpitchoune%2Fpnews%2Fservlet%2FHTML.java;h=28d6face2d3d8a43bf64daad29bc1b40456c27a0;hp=0000000000000000000000000000000000000000;hb=a0c6addfd9ac6ac45f37b4202e787602c40e6bf7;hpb=aff83c8798602b535d13edeaffdb8f4238e2bbf5 diff --git a/war/src/main/java/net/wpitchoune/pnews/servlet/HTML.java b/war/src/main/java/net/wpitchoune/pnews/servlet/HTML.java new file mode 100644 index 0000000..28d6fac --- /dev/null +++ b/war/src/main/java/net/wpitchoune/pnews/servlet/HTML.java @@ -0,0 +1,187 @@ +package net.wpitchoune.pnews.servlet; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.rometools.rome.io.FeedException; + +import net.wpitchoune.pnews.Article; +import net.wpitchoune.pnews.Category; +import net.wpitchoune.pnews.Config; +import net.wpitchoune.pnews.EntityStat; +import net.wpitchoune.pnews.Language; + +public class HTML { + private static final String CLASS_NAME= HTML.class.getName(); + private static final Logger LOG = Logger.getLogger(CLASS_NAME); + + private static void appendA(StringBuffer buf, String child, String href, String cl) { + buf.append("'); + buf.append(child); + buf.append(""); + } + + private static void appendDiv(StringBuffer buf, String child) { + buf.append("
"); + buf.append(child); + buf.append("
\n"); + } + + private static void append(StringBuffer buf, Article a) throws UnsupportedEncodingException { + buf.append(""); + if (a.getDescription().length() < 512) { + buf.append(a.getDescription()); + } else { + buf.append(a.getDescription().substring(0, 512)); + buf.append("[..]"); + } + buf.append("
"); + } + buf.append("