diff --git a/src/main/java/com/github/sbellus/fitnesse/codeprettifier/ListingSymbol.java b/src/main/java/com/github/sbellus/fitnesse/codeprettifier/ListingSymbol.java index 9b91c2b..d12d631 100644 --- a/src/main/java/com/github/sbellus/fitnesse/codeprettifier/ListingSymbol.java +++ b/src/main/java/com/github/sbellus/fitnesse/codeprettifier/ListingSymbol.java @@ -143,7 +143,7 @@ private String IdentXml(String content) { try { - Source xmlInput = new StreamSource(new StringReader(compact(content, false, false))); + Source xmlInput = new StreamSource(new StringReader(compact(content, false, false, false))); StringWriter stringWriter = new StringWriter(); StreamResult xmlOutput = new StreamResult(stringWriter); TransformerFactory transformerFactory = TransformerFactory.newInstance(); @@ -181,7 +181,7 @@ private static SymbolType closeType(char beginner) { : beginner == '{' ? SymbolType.CloseBrace : SymbolType.CloseParenthesis; } - private String compact(String input, Boolean keepNewLines, Boolean keepSpaces) { + private String compact(String input, Boolean keepNewLines, Boolean keepSpaces, Boolean transforToQuotString) { BufferedReader reader = new BufferedReader(new StringReader(input)); StringBuffer result = new StringBuffer(); @@ -193,8 +193,10 @@ private String compact(String input, Boolean keepNewLines, Boolean keepSpaces) { line = line.trim(); } - line = line.replaceAll("&", "&"); - line = line.replaceAll("\"", """); + if (transforToQuotString) { + line = line.replaceAll("&", "&"); + line = line.replaceAll("\"", """); + } if (keepNewLines) { line += "&\\n;"; @@ -232,7 +234,7 @@ public String toTarget(Translator translator, Symbol symbol) { keepSpaces = false; } - String originalContent = compact(symbol.getProperty("content"), keepNewLines, keepSpaces); + String originalContent = compact(symbol.getProperty("content"), keepNewLines, keepSpaces, true); listingSection.addAttribute("originalcontent", originalContent); listingSection.add(new RawHtml( ""));