Package org.apache.maven.doxia.parser
Interface Parser
-
- All Known Implementing Classes:
AbstractParser,AbstractTextParser,AbstractXmlParser,Xhtml1BaseParser,Xhtml5BaseParser
public interface ParserA Parser is responsible for parsing any document in a supported front-end format, and emitting the standard Doxia events, which can then be consumed by any Doxia Sink.- Since:
- 1.0
- Author:
- Jason van Zyl
-
-
Field Summary
Fields Modifier and Type Field Description static intTXT_TYPEText parser typestatic intUNKNOWN_TYPEUnknown parser typestatic intXML_TYPEXML parser type
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddSinkWrapperFactory(SinkWrapperFactory factory)Registers a givenSinkWrapperFactorywith the parser used in subsequent calls ofparse(...)intgetType()booleanisEmitAnchorsForIndexableEntries()Returns whether anchors are automatically generated for each index entry found byIndexingSinkor not.booleanisEmitComments()Does the parser emit Doxia comments event when comments found in source?voidparse(java.io.Reader source, org.apache.maven.doxia.sink.Sink sink)Parses the given source model and emits Doxia events into the given sink.voidparse(java.io.Reader source, org.apache.maven.doxia.sink.Sink sink, java.lang.String reference)Parses the given source model and emits Doxia events into the given sink.voidsetEmitAnchorsForIndexableEntries(boolean emitAnchors)Determines whether to automatically generate anchors for each index entry found byIndexingSinkor not.voidsetEmitComments(boolean emitComments)When comments are found in source markup, emit comment Doxia events or just ignore?voidsetMacroExecutor(MacroExecutor macroExecutor)Delegates macro execution to the givenMacroExecutor.
-
-
-
Field Detail
-
UNKNOWN_TYPE
static final int UNKNOWN_TYPE
Unknown parser type- See Also:
- Constant Field Values
-
TXT_TYPE
static final int TXT_TYPE
Text parser type- See Also:
- Constant Field Values
-
XML_TYPE
static final int XML_TYPE
XML parser type- See Also:
- Constant Field Values
-
-
Method Detail
-
parse
void parse(java.io.Reader source, org.apache.maven.doxia.sink.Sink sink) throws ParseExceptionParses the given source model and emits Doxia events into the given sink. Shortcut forparse(Reader, Sink, String)with last argument beingnull.- Parameters:
source- not null reader that provides the source document.sink- A sink that consumes the Doxia events.- Throws:
ParseException- if the model could not be parsed.
-
parse
void parse(java.io.Reader source, org.apache.maven.doxia.sink.Sink sink, java.lang.String reference) throws ParseExceptionParses the given source model and emits Doxia events into the given sink.- Parameters:
source- not null reader that provides the source document.sink- A sink that consumes the Doxia events.reference- a string identifying the source (for file based documents the source file path)- Throws:
ParseException- if the model could not be parsed.
-
getType
int getType()
- Returns:
- the type of Parser
-
setEmitComments
void setEmitComments(boolean emitComments)
When comments are found in source markup, emit comment Doxia events or just ignore?- Parameters:
emitComments-true(default value) to emit comment Doxia events
-
isEmitComments
boolean isEmitComments()
Does the parser emit Doxia comments event when comments found in source?- Returns:
true(default value) if comment Doxia events are emitted
-
addSinkWrapperFactory
void addSinkWrapperFactory(SinkWrapperFactory factory)
Registers a givenSinkWrapperFactorywith the parser used in subsequent calls ofparse(...)- Parameters:
factory- the factory to create the sink wrapper- Since:
- 2.0.0
-
setEmitAnchorsForIndexableEntries
void setEmitAnchorsForIndexableEntries(boolean emitAnchors)
Determines whether to automatically generate anchors for each index entry found byIndexingSinkor not. By default no anchors are generated.- Parameters:
emitAnchors-trueto emit anchors otherwisefalse(the default)- Since:
- 2.0.0
-
isEmitAnchorsForIndexableEntries
boolean isEmitAnchorsForIndexableEntries()
Returns whether anchors are automatically generated for each index entry found byIndexingSinkor not.- Returns:
trueif anchors are emitted otherwisefalse- Since:
- 2.0.0
-
setMacroExecutor
void setMacroExecutor(MacroExecutor macroExecutor)
Delegates macro execution to the givenMacroExecutor.- Parameters:
macroExecutor- (may benullto use the built-in macro executor, which resolves all macros toSinkmethods)}- Since:
- 2.1.0
-
-