org.apache.maven.doxia.macro.toc
Class TocMacro

java.lang.Object
  extended by org.apache.maven.doxia.macro.AbstractMacro
      extended by org.apache.maven.doxia.macro.toc.TocMacro
All Implemented Interfaces:
Macro

public class TocMacro
extends AbstractMacro

Macro to display a Table Of Content in a given Sink. The input for this macro are:

section
Display the specificated section number or all sections if 0 (in this case, other parameters are ignored).
Positive int, not mandatory, 0 by default.
fromDepth
Display the depth starting for the given section number.
Positive int, not mandatory, 0 by default.
toDepth
Display the depth ending for the given section number.
Positive int, not mandatory, 5 by default.
For instance, in an APT file, you could write:
%{toc|section=2|fromDepth=2|toDepth=2}
Display a TOC for the section number 2 in the document, from the subsection depth 1 to the subsection depth 2
%{toc}
display a TOC with all section and subsections (similar to %{toc|section=0} )
Moreover, you need to write APT link for section to allow anchor, for instance:
 * {SubSection 1}
 
Similarly, in an XDOC file, you could write:
 <macro name="toc">
   <param name="section" value="1" />
   <param name="fromDepth" value="1" />
   <param name="toDepth" value="2" />
 </macro>
 

Version:
$Id: TocMacro.java 561315 2007-07-31 12:50:41Z vsiveton $
Author:
Vincent Siveton

Field Summary
 
Fields inherited from interface org.apache.maven.doxia.macro.Macro
ROLE
 
Constructor Summary
TocMacro()
           
 
Method Summary
 void execute(Sink sink, MacroRequest request)
          Execute the current macro using the given MacroRequest, and emit events into the given sink.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TocMacro

public TocMacro()
Method Detail

execute

public void execute(Sink sink,
                    MacroRequest request)
             throws MacroExecutionException
Execute the current macro using the given MacroRequest, and emit events into the given sink.

Parameters:
sink - The sink to receive the events.
request - The corresponding MacroRequest.
Throws:
MacroExecutionException - if an error occurred during execution.


Copyright © 2002-2009 Apache Software Foundation. All Rights Reserved.