projects
/
asciidoctor_to_rss.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
e50967c
)
improved
author
Jean-Philippe Orsini
<jeanfi@gmail.com>
Fri, 1 Jul 2016 13:10:04 +0000
(15:10 +0200)
committer
Jean-Philippe Orsini
<jeanfi@gmail.com>
Fri, 1 Jul 2016 13:10:04 +0000
(15:10 +0200)
src/main/java/Main.java
patch
|
blob
|
history
diff --git
a/src/main/java/Main.java
b/src/main/java/Main.java
index
0dedab9
..
64b4d88
100644
(file)
--- a/
src/main/java/Main.java
+++ b/
src/main/java/Main.java
@@
-25,8
+25,9
@@
import com.rometools.rome.io.FeedException;
import com.rometools.rome.io.SyndFeedOutput;
public class Main {
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;
private static File toHTMLFile(File dir, File adoc) {
int idx;
@@
-52,6
+53,10
@@
public class Main {
return ret;
}
return ret;
}
+ private static String getFeedTitle(Properties props) {
+ return props.getProperty(KEY_FEED_TITLE);
+ }
+
private static void appendHTMLHeader(StringBuffer sb, Properties props)
throws IOException {
String fileName;
private static void appendHTMLHeader(StringBuffer sb, Properties props)
throws IOException {
String fileName;
@@
-65,8
+70,11
@@
public class Main {
}
f = new File(fileName);
}
f = new File(fileName);
+
+ sb.append("<head>\n");
sb.append(new String(Files.readAllBytes(f.toPath()),
StandardCharsets.UTF_8));
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 {
}
public static void main(String[] args) throws FileNotFoundException, IOException, FeedException {
@@
-96,18
+104,28
@@
public class Main {
asciidoctor = Factory.create();
feed = new SyndFeedImpl();
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();
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");
appendHTMLHeader(news, props);
news.append("<body>\n");
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;
for (File adoc: adocs) {
if (!adoc.getName().endsWith(".adoc"))
continue;
@@
-136,6
+154,8
@@
public class Main {
news.append(desc.toString());
news.append("\n</div>\n");
}
news.append(desc.toString());
news.append("\n</div>\n");
}
+
+ news.append("</div>\n");
news.append("</body>\n");
news.append("</html>\n");
news.append("</body>\n");
news.append("</html>\n");