scruf

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

commit 3124c400d828cacdf6b39cec92e6ba4e78253807
parent 5d892e9b95b9ee54aa3d5b34a9f2700a30101d2d
Author: rsiddharth <rsd@scruf>
Date:   Thu, 25 Oct 2012 01:11:30 +0530

 --> merged from devel branch.
added:
  notes
modified:
  license/gpl
  parsers/CodeBlocks.java
  parsers/WordDecoration.java

Diffstat:
license/gpl | 10++++++----
notes | 15+++++++++++++++
parsers/CodeBlocks.java | 6+++---
parsers/WordDecoration.java | 11++++++-----
4 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/license/gpl b/license/gpl @@ -1,8 +1,10 @@ /*+ - * Copyright (C) 2012-2013 rsiddharth - * email me : rsiddharth@ninthfloor.org - * - * This program is free software: you can redistribute it and/or modify + * Copyright 2012 rsiddharth + * Email: rsiddharth@ninthfloor.org + * + * This file is part of Scruf. + * + * Scruf is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. diff --git a/notes b/notes @@ -0,0 +1,14 @@ +markdown + ++ tags can be added in the markdown text, but they should *not* be +indented. The paragraph parser should recognize /tagged/ blocks and +simply ignore them. + ++ ` < ' if something starts with this, please don't parse the +following entity. + ++ automatic conversion of & --> &amp; according to the context. + autometic conversion of < --> &lt; according to the context. + + inside spans or blocks markdown always encodes the > &amp; & to + correponding thingies explained above.+ \ No newline at end of file diff --git a/parsers/CodeBlocks.java b/parsers/CodeBlocks.java @@ -4,7 +4,7 @@ import java.util.regex.*; public class CodeBlocks implements Parser { public String parse(String fileContent) { - Pattern pattern = Pattern.compile("(\\~\\~)\\n*(.+?)\\n*(\\1)", + Pattern pattern = Pattern.compile("(\\#\\#\\#)\\n*(.+?)\\n*(\\1)", Pattern.DOTALL); Matcher matcher = pattern.matcher(fileContent); LineBreak lbreak = new LineBreak(); @@ -12,9 +12,9 @@ public class CodeBlocks implements Parser { StringBuilder replacement = new StringBuilder(); while(matcher.find()) { replacement.delete(0,replacement.length()); - replacement.append("<code>"); + replacement.append("<div class=\\\"code\\\">"); replacement.append(quote(lbreak.parse(matcher.group(2)))); - replacement.append("</code>"); + replacement.append("</div>"); matcher.appendReplacement(sbuffer,replacement.toString()); } matcher.appendTail(sbuffer); diff --git a/parsers/WordDecoration.java b/parsers/WordDecoration.java @@ -9,14 +9,15 @@ public class WordDecoration implements Parser { private HashMap<String, String> tagMap; public WordDecoration() { tagMap = new HashMap<String, String>(); - tagMap.put("''","<i>$6</i>"); - tagMap.put("__","<u>$6</u>"); - tagMap.put("'''","<b>$6</b>"); - tagMap.put("%%%","<blockquote>$6</blockquote>"); + tagMap.put("''","<i>$7</i>"); + tagMap.put("__","<u>$7</u>"); + tagMap.put("'''","<b>$7</b>"); + tagMap.put("%%%","<blockquote>$7</blockquote>"); + tagMap.put("`","<div class=\\\"monospace\\\">$7</div>"); } public String parse(String fileContent) { Pattern pattern = - Pattern.compile("((\\'\\'\\')|(\\_\\_)|(\\'\\')|(\\%\\%\\%))(.+?)((\\2)|(\\3)|(\\4)|(\\5))", + Pattern.compile("((\\'\\'\\')|(\\_\\_)|(\\'\\')|(\\%\\%\\%))|(\\`))(.+?)((\\2)|(\\3)|(\\4)|(\\5)|(\\6))", Pattern.DOTALL); Matcher matcher = pattern.matcher(fileContent); StringBuffer sbuffer = new StringBuffer();