Interface MacroUtils


  • @Role
    public interface MacroUtils
    Utility class for macro handling.
    Since:
    3.0.3
    Version:
    $Id$
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      org.xwiki.rendering.block.XDOM getMacroContentXDOM​(org.xwiki.rendering.block.MacroBlock macroBlock, org.xwiki.rendering.syntax.Syntax syntax)
      Get the XDOM of the content of a macro.
      boolean isMacroContentParsable​(String macroId)  
      String renderMacroContent​(List<org.xwiki.rendering.block.Block> contentBlocks, org.xwiki.rendering.syntax.Syntax syntax)
      Render the macro content in the given syntax.
      void updateMacroContent​(org.xwiki.rendering.block.Block macro, String newContent)
      Update the content of a macro replacing it with a clone that has the desired content.
    • Method Detail

      • updateMacroContent

        void updateMacroContent​(org.xwiki.rendering.block.Block macro,
                                String newContent)
        Update the content of a macro replacing it with a clone that has the desired content.
        Parameters:
        macro - the macro that needs to be updated. It has to have a parent.
        newContent - the new content that will replace the current content of the macro.
      • getMacroContentXDOM

        org.xwiki.rendering.block.XDOM getMacroContentXDOM​(org.xwiki.rendering.block.MacroBlock macroBlock,
                                                           org.xwiki.rendering.syntax.Syntax syntax)
                                                    throws org.xwiki.rendering.macro.MacroExecutionException
        Get the XDOM of the content of a macro.
        Parameters:
        macroBlock - the block whose content we want to retrieve.
        syntax - The syntax in which the content is encoded.
        Returns:
        the XDOM of the macro content.
        Throws:
        org.xwiki.rendering.macro.MacroExecutionException - if parsing fails.
      • renderMacroContent

        String renderMacroContent​(List<org.xwiki.rendering.block.Block> contentBlocks,
                                  org.xwiki.rendering.syntax.Syntax syntax)
                           throws org.xwiki.component.manager.ComponentLookupException
        Render the macro content in the given syntax.
        Parameters:
        contentBlocks - the content of a macro.
        syntax - the syntax in which the contentBlocks need to be rendered.
        Returns:
        the result of rendering the content in the given syntax.
        Throws:
        org.xwiki.component.manager.ComponentLookupException - if there is no renderer for the given syntax
      • isMacroContentParsable

        boolean isMacroContentParsable​(String macroId)
        Parameters:
        macroId - the id of a macro. i.e. info
        Returns:
        true if the content of the macro can be parsed, supports xwiki syntax; false if not