summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsiddharth <rsiddharth@ninthfloor.org>2012-11-27 20:57:12 +0530
committerrsiddharth <rsiddharth@ninthfloor.org>2012-11-27 20:57:12 +0530
commit07e79180d6a9d1aeb5805d61dcd2687209af51ef (patch)
tree530ecc80c102b4866cf1db9e83e56d71231bbd09
parent16ab7e080e48c07c4ed4d1d1822cfad193a5e506 (diff)
new feature: Now Scruf appends a 'last updated' string at the end of
all html files, it generates. parsers/LastUpdate.java does this job. added: parsers/LastUpdate.java (new parser) modified: parsers/ParserList.java (added new Parser: see above) todo (now scruf todos are in org-mode)
-rw-r--r--parsers/LastUpdate.java30
-rw-r--r--parsers/ParserList.java1
-rw-r--r--todo47
3 files changed, 69 insertions, 9 deletions
diff --git a/parsers/LastUpdate.java b/parsers/LastUpdate.java
new file mode 100644
index 0000000..a7de460
--- /dev/null
+++ b/parsers/LastUpdate.java
@@ -0,0 +1,30 @@
+package scruf.parsers;
+
+import java.text.*;
+import java.util.*;
+
+/**
+ * This class produces a string of the current date. This 'current
+ * date' string is used append at end of the html page page.
+ */
+
+class LastUpdate implements Parser {
+ private String startBlock, endBlock;
+ private DateFormat date;
+ private StringBuilder sbuilder;
+ public LastUpdate() {
+ sbuilder = new StringBuilder();
+ startBlock = "\n<div class=\"lastupdate\">\n Last Updated on: ";
+ date = DateFormat.getDateInstance(DateFormat.LONG);
+ endBlock = "</div>\n";
+ }
+ public String parse(String fileContent) {
+ sbuilder.delete(0,sbuilder.length());
+ sbuilder.append(fileContent);
+ sbuilder.append(startBlock);
+ // date.format() returns the date at this instance in time.
+ sbuilder.append(date.format(new Date()));
+ sbuilder.append(endBlock);
+ return sbuilder.toString();
+ }
+} \ No newline at end of file
diff --git a/parsers/ParserList.java b/parsers/ParserList.java
index 685de25..2fba376 100644
--- a/parsers/ParserList.java
+++ b/parsers/ParserList.java
@@ -38,6 +38,7 @@ public class ParserList {
parsers.add(new Images());
parsers.add(new Footer());
parsers.add(new Paragraphs());
+ parsers.add(new LastUpdate());
parsers.add(new Source());
parsers.add(new BackButton());
parsers.add(new Header());
diff --git a/todo b/todo
index 90a0e85..3b73a80 100644
--- a/todo
+++ b/todo
@@ -1,17 +1,46 @@
-# introduce 'meta' info in html doc generated -- authorinfo, date of creation, etc.
+SCRUF - TODO -*- mode: org; -*-
-* introduction to 'scruf' & 'scruffy' mark-up. [working on this one]
+* features
-# Test it by generating your _full_ homepage using scruf.
+** 'last update' string
+ the 'last updated' string must be dangled somewhere in the document
+ that is licked by scruf.
-[done] way to ignore directories
-[done] move PresentFile.java to status/
+** <meta> tags
+ introduce 'meta' info in html doc generated -- authorinfo, date of
+ creation, etc.
-[done] extension for scruff marked-up files to make discovery easier.
-[done] modify conversion/CanConvert.java (bug)
+** implement lists
+ introduce mark-up for lists. Weird that I have not implement
+ yet.
-[done] include a link or something to view the 'source'.
-[done] 'quote' special symbols inside a code-block. \ No newline at end of file
+** [hp] documentation
+
+ introduction to 'scruf' & 'scruffy' mark-up. [started writing, but
+ might not get it done anytime in the near future.]
+
+
+* testing
+
+** build homepage
+ Test it by generating your _full_ homepage using scruf.
+
+* finished todos
+
+** [done] ignore directories
+ way to ignore directories
+
+** [done] move PresentFile.java to status/
+
+** [done] extension for scruffy files
+ extension for scruff marked-up files to make discovery easier.
+
+** [done] modify conversion/CanConvert.java (bug)
+
+** [done] link to scruffy source
+ include a link or something to view the 'source'.
+
+** [done] 'quote' special symbols inside a code-block.