fixed date output
[asciidoctor_to_rss.git] / src / main / java / net / wpitchoune / asciidoctor / Main.java
index 43f0a88..4cfe7fd 100644 (file)
@@ -55,6 +55,10 @@ public class Main {
 
        private static final Asciidoctor asciidoctor = Factory.create();
        
+        private static final SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("yyyy-dd-MM");
+        
+
+       
         private static File toHTMLFile(File dir, File adoc) {
                 int idx;
                 String name;
@@ -152,9 +156,6 @@ public class Main {
                StringBuffer news;
                String itemTitle, itemContent, itemURI, strDate;
                Date itemDate;
-               SimpleDateFormat sdf;
-               
-               sdf = new SimpleDateFormat("yyyy-dd-MM");
                
                inDir = new File(args[0]);
                outDir = new File(args[1]);
@@ -194,7 +195,7 @@ public class Main {
                        else
                                strDate = h.getAttributes().get("date").toString();
                                                
-                       itemDate = sdf.parse(strDate);
+                       itemDate = DATE_FORMATTER.parse(strDate);
                        
                        asciidoctor.convert(new FileReader(adoc), desc, new HashMap<String,Object>());
                        
@@ -220,7 +221,7 @@ public class Main {
                        news.append("</h2>");
                        if (news != null) {
                                news.append("<div class='date'>");
-                               news.append(itemDate);
+                               news.append(DATE_FORMATTER.format(itemDate));
                                news.append("</div>");
                        }
                        news.append(desc.toString());