scruf

darn simple HTML5 doc generator
git clone git://git.ricketyspace.net/scruf.git
Log | Files | Refs | README

commit 4618d216ccee183068725cba0778ff753bb656a4
parent 54e4ec0cc7f0b58e747729a0c5260044ca4c370f
Author: rsiddharth <rsiddharth@ninthfloor.org>
Date:   Wed, 14 Aug 2013 18:55:52 +0530

merged from the devel branch.

conversion/ConvertDirectory.java:
 * Changes in how `index.scruff' files are parsed.
 * StyleChecker checks where the stylesheet needs update/creation
parsers/CodeBlocks.java:
 * code block tag changed from <div class="code"> --> <pre> 
parsers/Images.java:
 * image alt text formatted for nice viewing in text terminal
 * SVGs are recognized by the parser now
parsers/QuoteSpecialText.java:
 * regex changed:
styling/style.css
 * lot of changes to the default CSS.

Diffstat:
conversion/ConvertDirectory.java | 9++++++---
etc/TODO | 15+++++----------
parsers/CodeBlocks.java | 4++--
parsers/Images.java | 6+++---
parsers/QuoteSpecialText.java | 2+-
styling/style.css | 43+++++++++++++++++++++++++++++++++++++------
6 files changed, 54 insertions(+), 25 deletions(-)

diff --git a/conversion/ConvertDirectory.java b/conversion/ConvertDirectory.java @@ -50,6 +50,7 @@ public class ConvertDirectory { IndexCreator index = new IndexCreator(directory); // iterate through the directory. System.out.println("Current Directory: "+directory.getAbsolutePath()); + // the FileSieve parse for .scruffy files (except index.scruffy): for(File file:directory.listFiles(new FileSieve())) { if(file.isFile()) { can = canConvert.check(file); @@ -57,9 +58,6 @@ public class ConvertDirectory { System.out.println("Converting..."+file.getAbsolutePath()); html.convert(file); index.add(file); - // check for style sheet in the directory; create/update - // if needed. - styleSheet.check(directory); } } else if(file.isDirectory()) { @@ -77,6 +75,11 @@ public class ConvertDirectory { System.out.println("Converting..."+index.indexFile().getAbsolutePath()); html.convert(index.indexFile()); } + // check whether this directory has scruffy files: + if(index.indexFile().exists()) { + // create/update stylesheet if need. + styleSheet.check(directory); + } --DirectoryInfo.level; } diff --git a/etc/TODO b/etc/TODO @@ -1,16 +1,11 @@ SCRUF - TODO -*- mode: org; -*- * features - -** build system (GNU auto tools) - -** test suite - -** implement lists - introduce mark-up for lists. Weird that I have not implement - yet. - -** mark-up to center align text +** proper semantic +** use markdownj for text to html5 conversion + that necessarily means scruffy markup will be done away with. +** page format options -- stream, singleton, +** build system (ant system) * distribution related ** NEWS file diff --git a/parsers/CodeBlocks.java b/parsers/CodeBlocks.java @@ -35,9 +35,9 @@ public class CodeBlocks implements Parser { StringBuilder replacement = new StringBuilder(); while(matcher.find()) { replacement.delete(0,replacement.length()); - replacement.append("<div class=\"code\">"); + replacement.append("<pre>"); replacement.append(lbreak.parse(symbolMap.quote(matcher.group(3)))); - replacement.append("</div>"); + replacement.append("</pre>"); matcher.appendReplacement(sbuffer,replacement.toString()); } matcher.appendTail(sbuffer); diff --git a/parsers/Images.java b/parsers/Images.java @@ -25,10 +25,10 @@ import java.util.regex.*; public class Images implements Parser { // set of strings to build the img tag - private String openTag = "<img src=\"$1\" alt=\" \\[$"; + private String openTag = "<img src=\"$1\" alt=\" \\[ $"; private String closeTag = " />"; public String parse(String fileContent) { - Pattern pattern = Pattern.compile("\\{\\{(.+?\\.(png|jpg))(\\|(.+?))?\\}\\}", Pattern.DOTALL); + Pattern pattern = Pattern.compile("\\{\\{(.+?\\.(png|jp[e]?g|svg))(\\|(.+?))?\\}\\}", Pattern.DOTALL); Matcher matcher = pattern.matcher(fileContent); StringBuffer sbuffer = new StringBuffer(); StringBuilder replacementString =new StringBuilder(); @@ -39,7 +39,7 @@ public class Images implements Parser { replacementString.append(openTag); // if the "title" is given add to the _img_ tag. if(matcher.group(3)!=null) { - replacementString.append("4\\] \" title=\"$4\""); + replacementString.append("4 \\] \" title=\"$4\""); } else { replacementString.append("1\""); diff --git a/parsers/QuoteSpecialText.java b/parsers/QuoteSpecialText.java @@ -33,7 +33,7 @@ public class QuoteSpecialText implements Parser { qmap.put(">","&gt;"); } public String parse(String fileContent) { - Pattern pattern = Pattern.compile("(\\&\\#35\\;)|(\\&)|(\\<)|(\\>)"); + Pattern pattern = Pattern.compile("(\\&(\\w+|\\#\\d+)\\;)|(\\&)|(\\<)|(\\>)"); Matcher matcher = pattern.matcher(fileContent); StringBuffer sbuffer = new StringBuffer(); while(matcher.find() && matcher.group(1)==null) { diff --git a/styling/style.css b/styling/style.css @@ -6,7 +6,7 @@ */ article { - font-size:1.50em; + font-size:1.50em; /* 1.88 */ font-family:"Palatino Linotype","Book Antiqua",Palatino,"URW Palladio L",FreeSerif,serif; color:#787878; margin-left:auto; @@ -14,7 +14,7 @@ article { border:1px; padding:5px; width:97%; - box-shadow: 1px 1.5px 3px 0.5px #bababa; + box-shadow: 1px 1.5px 3px 0.5px #bababa; } h1, h2, h3, h4, h5 { @@ -63,13 +63,19 @@ span.monospace { font-family:monospace; } -div.code { +pre { + display:block; font-family:monospace; font-size:0.625em; + word-break:break-all; + word-wrap:break-word; + white-space:pre-wrap; background-color:#fcfcfc; margin-left:auto; margin-right:auto; - border:1px; + margin-top:5px; + margin-bottom:5px; + border:1px solid #f0f0f0; padding:5px; width:70%; } @@ -108,7 +114,7 @@ a:link,a:visited { -webkit-transition:border-bottom 0.3s, color 0.3s; -o-transition:border-bottom 0.3s, color 0.3s; color:#686868; - border-bottom:1px dotted #d9d9d9; + border-bottom:1px solid #d9d9d9; text-decoration:none; } a:hover,a:active { @@ -121,6 +127,9 @@ div.back { font-size:0.7em; font-family:junicode,"Palatino Linotype","Book Antiqua",Palatino,"URW Palladio L",FreeSerif,serif; text-align:center; + transition: opacity 1s; + -webkit-transition: opacity 1s; + opacity: 0.3; color:#989898; margin-left:auto; margin-right:auto; @@ -128,6 +137,9 @@ div.back { padding:5px; width:7%; } +div.back:hover { + opacity: 1.0; +} footer { font-size:0.8em; @@ -145,6 +157,9 @@ div.lastupdate { font-size:0.6em; font-family:"Palatino Linotype","Book Antiqua",Palatino,"URW Palladio L",FreeSerif,serif; text-align:center; + transition: opacity 1s; + -webkit-transition: opacity 1s; + opacity:0.3; color:#989898; margin-left:auto; margin-right:auto; @@ -153,10 +168,17 @@ div.lastupdate { width:40%; } +div.lastupdate:hover { + opacity: 1.0; +} + div.source { - font-size:0.4em; + font-size:0.5em; font-family:monospace; text-align:center; + transition: opacity 1s; + -webkit-transition: opacity 1s; + opacity: 0.3; color:#989898; margin-left:auto; margin-right:auto; @@ -164,17 +186,26 @@ div.source { padding:5px; width:40%; } +div.source:hover { + opacity: 1.0; +} div.scruf { font-size:0.9em; font-family:"Palatino Linotype","Book Antiqua",Palatino,"URW Palladio L",FreeSerif,serif; text-align:center; + transition: opacity 1s; + -webkit-transition: opacity 1s; + opacity: 0.3; color:#bcbcbc; margin-left:auto; margin-right:auto; border:1px; padding:5px; width:40%; +} +div.scruf:hover { + opacity: 1.0; }