Class IndexingSink
- All Implemented Interfaces:
AutoCloseable,Markup,Sink
- Direct Known Subclasses:
CreateAnchorsForIndexEntries
IndexEntry objects for sections.- Author:
- Trygve Laugstøl, Vincent Siveton
-
Field Summary
Fields inherited from interface org.apache.maven.doxia.markup.Markup
COLON, EOL, EQUAL, GREATER_THAN, LEFT_CURLY_BRACKET, LEFT_SQUARE_BRACKET, LESS_THAN, MINUS, PLUS, QUOTE, RIGHT_CURLY_BRACKET, RIGHT_SQUARE_BRACKET, SEMICOLON, SLASH, SPACE, STARFields inherited from interface org.apache.maven.doxia.sink.Sink
JUSTIFY_CENTER, JUSTIFY_DEFAULT, JUSTIFY_LEFT, JUSTIFY_RIGHT, NUMBERING_DECIMAL, NUMBERING_LOWER_ALPHA, NUMBERING_LOWER_ROMAN, NUMBERING_UPPER_ALPHA, NUMBERING_UPPER_ROMAN, SECTION_LEVEL_1, SECTION_LEVEL_2, SECTION_LEVEL_3, SECTION_LEVEL_4, SECTION_LEVEL_5, SECTION_LEVEL_6 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidanchor(String name, SinkEventAttributes attributes) Starts an element which defines an anchor.voidclose()Closes the writer or the stream, if needed.This should only be called once the sink is closed.getTitle()Getter for the fieldtitle.protected voidonIndexEntry(IndexEntry entry) Called at the beginning of each entry (once all metadata about it is collected).peek()peek.voidpop()Removes the IndexEntry at the top of this stack.voidpush(IndexEntry entry) Pushes an IndexEntry onto the top of this stack.voidsection(int level, SinkEventAttributes attributes) Start a new section at the given level.voidsection_(int level) Ends a section at the given level.voidsectionTitle_(int level) Ends a section title at the given level.voidtext(String text, SinkEventAttributes attributes) Adds a text.voidtitle(SinkEventAttributes attributes) Starts the title element.voidtitle_()Ends the title element.Methods inherited from class org.apache.maven.doxia.sink.impl.SinkWrapper
address, address_, anchor_, article, article_, author, author_, blockquote, blockquote_, body, body_, bold, bold_, comment, content, content_, data, data_, date, date_, definedTerm, definedTerm_, definition, definition_, definitionList, definitionList_, definitionListItem, definitionListItem_, division, division_, figure, figure_, figureCaption, figureCaption_, figureGraphics, flush, footer, footer_, getDocumentLocator, getWrappedSink, head, head_, header, header_, horizontalRule, inline, inline_, italic, italic_, lineBreak, lineBreakOpportunity, link, link_, list, list_, listItem, listItem_, markupLineBreak, monospaced, monospaced_, navigation, navigation_, nonBreakingSpace, numberedList, numberedList_, numberedListItem, numberedListItem_, pageBreak, paragraph, paragraph_, rawText, sectionTitle, setDocumentLocator, setWrappedSink, sidebar, sidebar_, table, table_, tableCaption, tableCaption_, tableCell, tableCell_, tableHeaderCell, tableHeaderCell_, tableRow, tableRow_, tableRows, tableRows_, time, time_, unknown, verbatim, verbatim_Methods inherited from class org.apache.maven.doxia.sink.impl.AbstractSink
address, anchor, article, author, blockquote, body, content, data, date, definedTerm, definition, definitionList, definitionListItem, division, figure, figureCaption, figureGraphics, footer, formatLocation, getLocationLogPrefix, head, header, horizontalRule, init, inline, lineBreak, lineBreakOpportunity, link, list, listItem, navigation, numberedList, numberedListItem, paragraph, section1, section1_, section2, section2_, section3, section3_, section4, section4_, section5, section5_, section6, section6_, sectionTitle, sectionTitle_, sectionTitle1, sectionTitle1_, sectionTitle2, sectionTitle2_, sectionTitle3, sectionTitle3_, sectionTitle4, sectionTitle4_, sectionTitle5, sectionTitle5_, sectionTitle6, sectionTitle6_, sidebar, table, tableCaption, tableCell, tableHeaderCell, tableRow, tableRows, text, time, title, unifyEOLs, verbatim
-
Constructor Details
-
IndexingSink
Deprecated.legacy constructor, useIndexingSink(Sink)withSinkAdapteras argument and callgetRootEntry()to retrieve the index tree afterwards. -
IndexingSink
-
-
Method Details
-
getRootEntry
This should only be called once the sink is closed. Before that the tree might not be complete.- Returns:
- the tree of entries starting from the root
- Throws:
IllegalStateException- in case the sink was not closed yet
-
getTitle
- Returns:
- the title
-
title
Description copied from interface:SinkStarts the title element. This is used to identify the document.Supported attributes are the
base attributes.- Specified by:
titlein interfaceSink- Overrides:
titlein classSinkWrapper- Parameters:
attributes- A set ofSinkEventAttributes, may benull.- See Also:
-
title_
Description copied from interface:SinkEnds the title element.- Specified by:
title_in interfaceSink- Overrides:
title_in classSinkWrapper
-
section
Description copied from interface:SinkStart a new section at the given level.Sections with higher level have to be entirely contained within sections of lower level.
Supported attributes are the
base attributes.- Specified by:
sectionin interfaceSink- Overrides:
sectionin classSinkWrapper- Parameters:
level- the section level (must be a value between 1 and 6).attributes- A set ofSinkEventAttributes, may benull.
-
section_
Description copied from interface:SinkEnds a section at the given level. -
sectionTitle_
Description copied from interface:SinkEnds a section title at the given level.- Specified by:
sectionTitle_in interfaceSink- Overrides:
sectionTitle_in classSinkWrapper- Parameters:
level- the section title level (must be a value between 1 and 6).
-
text
Description copied from interface:SinkAdds a text.The
textparameter should contain only real content, ie any ignorable/collapsable whitespace/EOLs or other pretty-printing should be removed/normalized by a parser.If
textcontains any variants of line terminators, they should be normalized to the System EOL by an implementing Sink.Supported attributes are the
base attributesplusSEMANTICS(values "emphasis", "strong", "small", "line-through", "citation", "quote", "definition", "abbreviation", "italic", "bold", "monospaced", "variable", "sample", "keyboard", "superscript", "subscript", "annotation", "highlight", "ruby", "rubyBase", "rubyText", "rubyTextContainer", "rubyParentheses", "bidirectionalIsolation", "bidirectionalOverride", "phrase", "insert", "delete").The following attributes are deprecated:
VALIGN(values "sub", "sup"),DECORATION(values "underline", "overline", "line-through"),STYLE(values "italic", "bold", "monospaced").- Specified by:
textin interfaceSink- Overrides:
textin classSinkWrapper- Parameters:
text- The text to write.attributes- A set ofSinkEventAttributes, may benull.
-
anchor
Description copied from interface:SinkStarts an element which defines an anchor.The
nameparameter has to be a valid SGML NAME token. According to the HTML 4.01 specification section 6.2 SGML basic types:ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
Supported attributes are the
base attributes. IfNAMEis specified in the SinkEventAttributes, it will be overwritten by thenameparameter.- Specified by:
anchorin interfaceSink- Overrides:
anchorin classSinkWrapper- Parameters:
name- the name of the anchor. This has to be a valid SGML NAME token.attributes- A set ofSinkEventAttributes, may benull.
-
onIndexEntry
Called at the beginning of each entry (once all metadata about it is collected). The events for the metadata are buffered and only flushed after this method was called.- Parameters:
entry- the newly collected entry
-
push
Pushes an IndexEntry onto the top of this stack.- Parameters:
entry- to put.
-
pop
Removes the IndexEntry at the top of this stack. -
peek
peek.
- Returns:
- Looks at the IndexEntry at the top of this stack.
-
close
Description copied from interface:SinkCloses the writer or the stream, if needed. Closing a previously-closed Sink has no effect.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSink- Overrides:
closein classSinkWrapper
-
IndexingSink(Sink)withSinkAdapteras argument and callgetRootEntry()to retrieve the index tree afterwards.