diff options
author | rsiddharth <rsiddharth@ninthfloor.org> | 2012-11-11 19:09:17 +0530 |
---|---|---|
committer | rsiddharth <rsiddharth@ninthfloor.org> | 2012-11-11 19:09:17 +0530 |
commit | 9e0a6a78616ab9ede6830c078245a195791e5ee4 (patch) | |
tree | bb85a02ed606ca2475392a5b77ff887b6f06cda3 /parsers/QuoteSpecialText.java | |
parent | ab443161eaa4cb631423884972108785ce764269 (diff) |
new feature: special text (symbols) are quoted to HTML number inside a
code-block
modified:
parsers/CodeBlocks.java (new class 'SymbolMap' which has a list of
symbols & their corresponding HTML number)
( quote() in 'CodeBlock' class uses the
SymbolMap to quote text)
parsers/ParserList.java (list re-ordered, CodeBlock has gone up)
parsers/QuoteSpecialText.java ( if regex matches '#', it leaves
the text un-quoted)
Diffstat (limited to 'parsers/QuoteSpecialText.java')
-rw-r--r-- | parsers/QuoteSpecialText.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/parsers/QuoteSpecialText.java b/parsers/QuoteSpecialText.java index 165ffa9..76241cc 100644 --- a/parsers/QuoteSpecialText.java +++ b/parsers/QuoteSpecialText.java @@ -33,10 +33,10 @@ public class QuoteSpecialText implements Parser { qmap.put(">",">"); } public String parse(String fileContent) { - Pattern pattern = Pattern.compile("(\\&)|(\\<)|(\\>)"); + Pattern pattern = Pattern.compile("(\\&\\#35\\;)|(\\&)|(\\<)|(\\>)"); Matcher matcher = pattern.matcher(fileContent); StringBuffer sbuffer = new StringBuffer(); - while(matcher.find()) { + while(matcher.find() && matcher.group(1)==null) { matcher.appendReplacement(sbuffer, qmap.get(matcher.group())); } |