use of org.xwiki.rendering.converter.Converter in project xwiki-platform by xwiki.
the class DefaultWikiMacroTest method testExecuteWhenWithDifferentMacroSyntax.
/**
* Check that macro used inside wiki macro are executed with the right syntax.
*/
@Test
public void testExecuteWhenWithDifferentMacroSyntax() throws Exception {
registerWikiMacro("wikimacro", "{{groovy}}println \"[[path:/some/path]]\"{{/groovy}}", Syntax.XWIKI_2_1);
Converter converter = getComponentManager().getInstance(Converter.class);
DefaultWikiPrinter printer = new DefaultWikiPrinter();
converter.convert(new StringReader("{{wikimacro param1=\"value1\" param2=\"value2\"/}}"), Syntax.XWIKI_2_0, Syntax.XHTML_1_0, printer);
// Note: We're using XHTML as the output syntax just to make it easy for asserting.
Assert.assertEquals("<p><span class=\"wikiinternallink\"><a href=\"/some/path\">" + "<span class=\"wikigeneratedlinkcontent\">/some/path</span></a></span></p>", printer.toString());
}
Aggregations