@Component(role=Macro.class, hint="toc") public class TocMacro extends AbstractMacro
Table Of Content
in a given Sink
.
The input parameters for this macro are:
* {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>
Modifier and Type | Field and Description |
---|---|
private static int |
DEFAULT_DEPTH
The default end depth.
|
private int |
fromDepth
Start depth.
|
private int |
section
The section to display.
|
private int |
toDepth
End depth.
|
Constructor and Description |
---|
TocMacro() |
Modifier and Type | Method and Description |
---|---|
void |
execute(Sink sink,
MacroRequest request)
Execute the current macro using the given MacroRequest,
and emit events into the given sink.
|
private static int |
getInt(MacroRequest request,
java.lang.String parameter,
int defaultValue) |
private void |
writeSubSectionN(Sink sink,
IndexEntry sectionIndex,
int n) |
enableLogging, getAttributesFromMap, getLog, required
private int section
private int fromDepth
private int toDepth
private static final int DEFAULT_DEPTH
public void execute(Sink sink, MacroRequest request) throws MacroExecutionException
sink
- The sink to receive the events.request
- The corresponding MacroRequest.MacroExecutionException
- if an error occurred during execution.private void writeSubSectionN(Sink sink, IndexEntry sectionIndex, int n)
sink
- The sink to write to.sectionIndex
- The section index.n
- The toc depth.private static int getInt(MacroRequest request, java.lang.String parameter, int defaultValue) throws MacroExecutionException
request
- The MacroRequest.parameter
- The parameter.defaultValue
- the default value.MacroExecutionException
- if something goes wrong.