@Test void testExecute() throws Exception { registerWikiMacro("wikimacro1", "This is **bold**", Syntax.XWIKI_2_0); assertXHTML("<p>This is <strong>bold</strong></p>", "{{wikimacro1 param1=\"value1\" param2=\"value2\"/}}"); assertXDOM("<document><p><metadata><metadata><entry><string>syntax</string>" + "<org.xwiki.rendering.syntax.Syntax><type><name>XWiki</name><id>xwiki</id></type><version>2.0</version></org.xwiki.rendering.syntax.Syntax></entry></metadata></metadata></p>" + "<macroMarker name=\"wikimacro1\"><p><parameters><entry><string>param1</string><string>value1</string></entry><entry><string>param2</string><string>value2</string></entry></parameters></p>" + "<paragraph><word>This</word><space></space><word>is</word><space></space><format format=\"BOLD\"><word>bold</word></format></paragraph>" + "</macroMarker></document>", "{{wikimacro1 param1=\"value1\" param2=\"value2\"/}}"); }
@Override public List<Block> execute(WikiMacroParameters parameters, String macroContent, MacroTransformationContext context) throws MacroExecutionException { DefaultWikiMacroRenderer renderer; try { renderer = this.componentManager.getInstance(DefaultWikiMacroRenderer.class); } catch (ComponentLookupException e) { throw new MacroExecutionException("Failed to create wiki macro rendeder", e); } validate(parameters, macroContent); renderer.initialize(this, parameters, macroContent, context); AsyncRendererConfiguration configuration = new AsyncRendererConfiguration(); configuration.setSecureReference(getDocumentReference(), getAuthorReference()); configuration.setContextEntries(this.contextEntries); Block result; try { result = this.executor.execute(renderer, configuration); } catch (Exception e) { throw new MacroExecutionException("Failed to execute wiki macro", e); } return result instanceof CompositeBlock ? result.getChildren() : Arrays.asList(result); }
DefaultWikiMacro extends AbstractAsyncContentBaseObjectWikiComponent implements WikiMacro, NestedScriptMacroEnabled, WikiMacroConstants { @Override public List<Block> execute(WikiMacroParameters parameters, String macroContent, MacroTransformationContext context) throws MacroExecutionException { DefaultWikiMacroRenderer renderer; try { renderer = this.componentManager.getInstance(DefaultWikiMacroRenderer.class); } catch (ComponentLookupException e) { throw new MacroExecutionException("Failed to create wiki macro rendeder", e); } validate(parameters, macroContent); renderer.initialize(this, parameters, macroContent, context); AsyncRendererConfiguration configuration = new AsyncRendererConfiguration(); configuration.setSecureReference(getDocumentReference(), getAuthorReference()); configuration.setContextEntries(this.contextEntries); Block result; try { result = this.executor.execute(renderer, configuration); } catch (Exception e) { throw new MacroExecutionException("Failed to execute wiki macro", e); } return result instanceof CompositeBlock ? result.getChildren() : Arrays.asList(result); } }
DefaultWikiMacro extends AbstractAsyncContentBaseObjectWikiComponent implements WikiMacro, NestedScriptMacroEnabled, WikiMacroConstants { @Override public List<Block> execute(WikiMacroParameters parameters, String macroContent, MacroTransformationContext context) throws MacroExecutionException { DefaultWikiMacroRenderer renderer; try { renderer = this.componentManager.getInstance(DefaultWikiMacroRenderer.class); } catch (ComponentLookupException e) { throw new MacroExecutionException("Failed to create wiki macro rendeder", e); } validate(parameters, macroContent); renderer.initialize(this, parameters, macroContent, context); AsyncRendererConfiguration configuration = new AsyncRendererConfiguration(); configuration.setSecureReference(getDocumentReference(), getAuthorReference()); configuration.setContextEntries(this.contextEntries); Block result; try { result = this.executor.execute(renderer, configuration); } catch (Exception e) { throw new MacroExecutionException("Failed to execute wiki macro", e); } return result instanceof CompositeBlock ? result.getChildren() : Arrays.asList(result); } DefaultWikiMacro(BaseObject baseObject, MacroDescriptor descriptor, ComponentManager componentManager); }
DefaultWikiMacro extends AbstractAsyncContentBaseObjectWikiComponent implements WikiMacro, NestedScriptMacroEnabled, WikiMacroConstants { @Override public List<Block> execute(WikiMacroParameters parameters, String macroContent, MacroTransformationContext context) throws MacroExecutionException { DefaultWikiMacroRenderer renderer; try { renderer = this.componentManager.getInstance(DefaultWikiMacroRenderer.class); } catch (ComponentLookupException e) { throw new MacroExecutionException("Failed to create wiki macro rendeder", e); } validate(parameters, macroContent); renderer.initialize(this, parameters, macroContent, context); AsyncRendererConfiguration configuration = new AsyncRendererConfiguration(); configuration.setSecureReference(getDocumentReference(), getAuthorReference()); configuration.setContextEntries(this.contextEntries); Block result; try { result = this.executor.execute(renderer, configuration); } catch (Exception e) { throw new MacroExecutionException("Failed to execute wiki macro", e); } return result instanceof CompositeBlock ? result.getChildren() : Arrays.asList(result); } DefaultWikiMacro(BaseObject baseObject, MacroDescriptor descriptor, ComponentManager componentManager); @Override List<Block> execute(WikiMacroParameters parameters, String macroContent,
        MacroTransformationContext context); @Override MacroDescriptor getDescriptor(); @Override int getPriority(); @Override String getId(); @Override int compareTo(Macro<?> macro); @Override boolean supportsInlineMode(); }
DefaultWikiMacro extends AbstractAsyncContentBaseObjectWikiComponent implements WikiMacro, NestedScriptMacroEnabled, WikiMacroConstants { @Override public List<Block> execute(WikiMacroParameters parameters, String macroContent, MacroTransformationContext context) throws MacroExecutionException { DefaultWikiMacroRenderer renderer; try { renderer = this.componentManager.getInstance(DefaultWikiMacroRenderer.class); } catch (ComponentLookupException e) { throw new MacroExecutionException("Failed to create wiki macro rendeder", e); } validate(parameters, macroContent); renderer.initialize(this, parameters, macroContent, context); AsyncRendererConfiguration configuration = new AsyncRendererConfiguration(); configuration.setSecureReference(getDocumentReference(), getAuthorReference()); configuration.setContextEntries(this.contextEntries); Block result; try { result = this.executor.execute(renderer, configuration); } catch (Exception e) { throw new MacroExecutionException("Failed to execute wiki macro", e); } return result instanceof CompositeBlock ? result.getChildren() : Arrays.asList(result); } DefaultWikiMacro(BaseObject baseObject, MacroDescriptor descriptor, ComponentManager componentManager); @Override List<Block> execute(WikiMacroParameters parameters, String macroContent,
        MacroTransformationContext context); @Override MacroDescriptor getDescriptor(); @Override int getPriority(); @Override String getId(); @Override int compareTo(Macro<?> macro); @Override boolean supportsInlineMode();  }