import com.rometools.rome.io.SyndFeedOutput;
public class Main {
- private static Logger LOG = Logger.getLogger(Main.class.getSimpleName());
- private static String KEY_HTML_HEADER_FILE = "html.header.file";
+ private static final Logger LOG = Logger.getLogger(Main.class.getSimpleName());
+ private static final String KEY_HTML_HEADER_FILE = "html.header.file";
+ private static final String KEY_FEED_TITLE = "feed.title";
private static File toHTMLFile(File dir, File adoc) {
int idx;
return ret;
}
- private static String getHTMLHeader(Properties props) throws IOException {
+ private static String getFeedTitle(Properties props) {
+ return props.getProperty(KEY_FEED_TITLE);
+ }
+
+ private static void appendHTMLHeader(StringBuffer sb, Properties props)
+ throws IOException {
String fileName;
File f;
if (fileName == null) {
LOG.info(KEY_HTML_HEADER_FILE + " is not set");
- return null;
+ return ;
}
f = new File(fileName);
- return new String(Files.readAllBytes(f.toPath()),
- StandardCharsets.UTF_8);
+
+ sb.append("<head>\n");
+ sb.append(new String(Files.readAllBytes(f.toPath()),
+ StandardCharsets.UTF_8));
+ sb.append("</head>\n");
}
public static void main(String[] args) throws FileNotFoundException, IOException, FeedException {
asciidoctor = Factory.create();
feed = new SyndFeedImpl();
- feed.setTitle(props.getProperty("feed.title"));
+ feed.setTitle(getFeedTitle(props));
feed.setDescription(props.getProperty("feed.description"));
feed.setLink(props.getProperty("feed.link"));
entries = new ArrayList<SyndEntry>();
news = new StringBuffer();
- news.append("<html>\n");
+ news.append("<!DOCTYPE html>\n");
+ news.append("<html>\n");
- getHTMLHeader(props);
+ appendHTMLHeader(news, props);
news.append("<body>\n");
+
+ news.append("<div id='header'>\n");
+ news.append("<h1>");
+ news.append(getFeedTitle(props));
+ news.append("</h1>\n");
+ news.append("</div>");
+
+ news.append("<div id='content'>\n");
+
for (File adoc: adocs) {
if (!adoc.getName().endsWith(".adoc"))
continue;
news.append(desc.toString());
news.append("\n</div>\n");
}
+
+ news.append("</div>\n");
news.append("</body>\n");
news.append("</html>\n");