import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Properties;
+import java.util.logging.Logger;
import org.asciidoctor.Asciidoctor;
import org.asciidoctor.Asciidoctor.Factory;
import com.rometools.rome.io.SyndFeedOutput;
public class Main {
- private static String KEY_HTML_HEADER = "html.header";
+ private static Logger LOG = Logger.getLogger(Main.class.getSimpleName());
+ private static String KEY_HTML_HEADER_FILE = "html.header.file";
private static File toHTMLFile(File dir, File adoc) {
int idx;
return ret;
}
- private static String getHTMLHeader(Properties props) {
- return null;
+ private static String getHTMLHeader(Properties props) throws IOException {
+ String fileName;
+ File f;
+
+ fileName = props.getProperty(KEY_HTML_HEADER_FILE);
+
+ if (fileName == null) {
+ LOG.info(KEY_HTML_HEADER_FILE + " is not set");
+ return null;
+ }
+
+ f = new File(fileName);
+ return new String(Files.readAllBytes(f.toPath()),
+ StandardCharsets.UTF_8);
}
public static void main(String[] args) throws FileNotFoundException, IOException, FeedException {
news = new StringBuffer();
news.append("<html>\n");
+
+ getHTMLHeader(props);
+
news.append("<body>\n");
for (File adoc: adocs) {
if (!adoc.getName().endsWith(".adoc"))
output.output(feed, new File(outDir, "feed.xml"));
System.out.println(news.toString());
+ Files.write(new File(outDir, "news.html").toPath(), news.toString().getBytes());
}
}