org.xwiki.rendering.internal.macro.toc
Class TocMacro
java.lang.Object
org.xwiki.rendering.macro.AbstractMacro<TocMacroParameters>
org.xwiki.rendering.internal.macro.toc.TocMacro
- All Implemented Interfaces:
- Comparable<Macro<?>>, Initializable, Macro<TocMacroParameters>
@Component
@Named(value="toc")
@Singleton
public class TocMacro
- extends AbstractMacro<TocMacroParameters>
Generate a Table Of Contents based on the document sections.
- Since:
- 1.5M2
Constructor Summary |
TocMacro()
Create and initialize the descriptor of the macro. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TocMacro
public TocMacro()
- Create and initialize the descriptor of the macro.
initialize
public void initialize()
throws InitializationException
- Description copied from interface:
Initializable
- Method called by the Component Manager when the component is created for the first time (i.e. when it's looked up
for the first time or if the component is specified as being loaded on startup). If the component instantiation
strategy is singleton then this method is called only once during the lifecycle of the Component Manager.
Otherwise the component is created at each lookup and thus this method is called at each lookup too.
- Specified by:
initialize
in interface Initializable
- Overrides:
initialize
in class AbstractMacro<TocMacroParameters>
- Throws:
InitializationException
- if an error happens during a component's initialization
supportsInlineMode
public boolean supportsInlineMode()
- Returns:
- true if the macro can be inserted in some existing content such as a paragraph, a list item etc. For
example if I have
== hello {{velocity}}world{{/velocity}}
then the Velocity macro must
support the inline mode and not generate a paragraph.
execute
public List<Block> execute(TocMacroParameters parameters,
String content,
MacroTransformationContext context)
throws MacroExecutionException
- Description copied from interface:
Macro
- Executes the macro.
- Parameters:
parameters
- the macro parameters in the form of a bean defined by the Macro
implementationcontent
- the content of the macrocontext
- the context of the macros transformation process
- Returns:
- the result of the macro execution as a list of Block elements
- Throws:
MacroExecutionException
- error when executing the macro