From 9e0a6a78616ab9ede6830c078245a195791e5ee4 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sun, 11 Nov 2012 19:09:17 +0530 Subject: 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) --- parsers/QuoteSpecialText.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'parsers/QuoteSpecialText.java') 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())); } -- cgit v1.2.3