Search in sources :

Example 11 with Converter

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());
}
Also used : DefaultWikiPrinter(org.xwiki.rendering.renderer.printer.DefaultWikiPrinter) StringReader(java.io.StringReader) Converter(org.xwiki.rendering.converter.Converter) Test(org.junit.Test)

Aggregations

StringReader (java.io.StringReader)11 Converter (org.xwiki.rendering.converter.Converter)11 DefaultWikiPrinter (org.xwiki.rendering.renderer.printer.DefaultWikiPrinter)11 Test (org.junit.Test)10 HashMap (java.util.HashMap)3 Expectations (org.jmock.Expectations)3 Reader (java.io.Reader)2 Writer (java.io.Writer)2 Map (java.util.Map)2 Properties (java.util.Properties)2 VelocityContext (org.apache.velocity.VelocityContext)2 Description (org.hamcrest.Description)2 Action (org.jmock.api.Action)2 Invocation (org.jmock.api.Invocation)2 DefaultComponentDescriptor (org.xwiki.component.descriptor.DefaultComponentDescriptor)2 Execution (org.xwiki.context.Execution)2 VelocityEngine (org.xwiki.velocity.VelocityEngine)2 VelocityManager (org.xwiki.velocity.VelocityManager)2 HTMLConverter (info.bliki.wiki.filter.HTMLConverter)1 WikiModel (info.bliki.wiki.model.WikiModel)1