@Test public void escape10Syntax() throws Exception { assertEquals("\\\\", this.mocker.getComponentUnderTest().escape("\\", Syntax.XWIKI_1_0)); assertEquals("\\*\\t\\e\\s\\t\\*", this.mocker.getComponentUnderTest() .escape("*test*", Syntax.XWIKI_1_0)); assertEquals("\\a\\\\\\\\\\[\\l\\i\\n\\k\\>\\X\\.\\Y\\]", this.mocker.getComponentUnderTest().escape("a\\\\[link>X.Y]", Syntax.XWIKI_1_0)); assertEquals("\\{\\p\\r\\e\\}\\v\\e\\r\\b\\a\\t\\i\\m\\{\\/\\p\\r\\e\\}", this.mocker .getComponentUnderTest().escape("{pre}verbatim{/pre}", Syntax.XWIKI_1_0)); assertEquals("\\{\\m\\a\\c\\r\\o\\:\\s\\o\\m\\e\\=\\p\\a\\r\\a\\m\\e\\t\\e\\r\\}" + "\\c\\o\\n\\t\\e\\n\\t" + "\\{\\m\\a\\c\\r\\o\\}", this.mocker.getComponentUnderTest().escape("{macro:some=parameter}content{macro}", Syntax.XWIKI_1_0)); }
public String escape(String content, Syntax syntax) { if (content == null || syntax == null) { return null; } char escapeChar; try { escapeChar = getEscapeCharacter(syntax); } catch (Exception e) { return null; } char[] result = new char[content.length() * 2]; for (int i = 0; i < content.length(); i++) { result[2 * i] = escapeChar; result[2 * i + 1] = content.charAt(i); } return String.valueOf(result); }
RenderingScriptService implements ScriptService { public String escape(String content, Syntax syntax) { if (content == null || syntax == null) { return null; } char escapeChar; try { escapeChar = getEscapeCharacter(syntax); } catch (Exception e) { return null; } char[] result = new char[content.length() * 2]; for (int i = 0; i < content.length(); i++) { result[2 * i] = escapeChar; result[2 * i + 1] = content.charAt(i); } return String.valueOf(result); } }
RenderingScriptService implements ScriptService { public String escape(String content, Syntax syntax) { if (content == null || syntax == null) { return null; } char escapeChar; try { escapeChar = getEscapeCharacter(syntax); } catch (Exception e) { return null; } char[] result = new char[content.length() * 2]; for (int i = 0; i < content.length(); i++) { result[2 * i] = escapeChar; result[2 * i + 1] = content.charAt(i); } return String.valueOf(result); }  }
RenderingScriptService implements ScriptService { public String escape(String content, Syntax syntax) { if (content == null || syntax == null) { return null; } char escapeChar; try { escapeChar = getEscapeCharacter(syntax); } catch (Exception e) { return null; } char[] result = new char[content.length() * 2]; for (int i = 0; i < content.length(); i++) { result[2 * i] = escapeChar; result[2 * i + 1] = content.charAt(i); } return String.valueOf(result); }  List<Syntax> getAvailableParserSyntaxes(); List<Syntax> getAvailableRendererSyntaxes(); List<String> getDefaultTransformationNames(); XDOM parse(String text, String syntaxId); String render(Block block, String outputSyntaxId); Syntax resolveSyntax(String syntaxId); String escape(String content, Syntax syntax); List<Syntax> getConfiguredSyntaxes(); List<Syntax> getDisabledSyntaxes(); List<MacroDescriptor> getMacroDescriptors(Syntax syntax); MacroId resolveMacroId(String macroIdAsString); MacroDescriptor getMacroDescriptor(MacroId macroId); }
RenderingScriptService implements ScriptService { public String escape(String content, Syntax syntax) { if (content == null || syntax == null) { return null; } char escapeChar; try { escapeChar = getEscapeCharacter(syntax); } catch (Exception e) { return null; } char[] result = new char[content.length() * 2]; for (int i = 0; i < content.length(); i++) { result[2 * i] = escapeChar; result[2 * i + 1] = content.charAt(i); } return String.valueOf(result); }  List<Syntax> getAvailableParserSyntaxes(); List<Syntax> getAvailableRendererSyntaxes(); List<String> getDefaultTransformationNames(); XDOM parse(String text, String syntaxId); String render(Block block, String outputSyntaxId); Syntax resolveSyntax(String syntaxId); String escape(String content, Syntax syntax); List<Syntax> getConfiguredSyntaxes(); List<Syntax> getDisabledSyntaxes(); List<MacroDescriptor> getMacroDescriptors(Syntax syntax); MacroId resolveMacroId(String macroIdAsString); MacroDescriptor getMacroDescriptor(MacroId macroId);  }