From d8883d357e25209747c8535bfd3b5a6e8d80dc57 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Thu, 25 Oct 2012 01:10:35 +0530 Subject: added: notes modified: license/gpl parsers/CodeBlocks.java parsers/WordDecoration.java --- license/gpl | 10 ++++++---- notes | 14 ++++++++++++++ parsers/CodeBlocks.java | 6 +++--- parsers/WordDecoration.java | 11 ++++++----- 4 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 notes diff --git a/license/gpl b/license/gpl index 133291f..026ff62 100644 --- 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 new file mode 100644 index 0000000..fb553c5 --- /dev/null +++ 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 & --> & according to the context. + autometic conversion of < --> < according to the context. + + inside spans or blocks markdown always encodes the > & & to + correponding thingies explained above. \ No newline at end of file diff --git a/parsers/CodeBlocks.java b/parsers/CodeBlocks.java index f3adb52..50794a5 100644 --- 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(""); + replacement.append("
"); replacement.append(quote(lbreak.parse(matcher.group(2)))); - replacement.append(""); + replacement.append("
"); matcher.appendReplacement(sbuffer,replacement.toString()); } matcher.appendTail(sbuffer); diff --git a/parsers/WordDecoration.java b/parsers/WordDecoration.java index b2df37e..66a5183 100644 --- a/parsers/WordDecoration.java +++ b/parsers/WordDecoration.java @@ -9,14 +9,15 @@ public class WordDecoration implements Parser { private HashMap tagMap; public WordDecoration() { tagMap = new HashMap(); - tagMap.put("''","$6"); - tagMap.put("__","$6"); - tagMap.put("'''","$6"); - tagMap.put("%%%","
$6
"); + tagMap.put("''","$7"); + tagMap.put("__","$7"); + tagMap.put("'''","$7"); + tagMap.put("%%%","
$7
"); + tagMap.put("`","
$7
"); } 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(); -- cgit v1.2.3