Package org.apache.maven.doxia.parser
Interface Parser
- All Known Implementing Classes:
AbstractParser
,AbstractTextParser
,AbstractXmlParser
,AptParser
,FmlContentParser
,FmlParser
,MarkdownParser
,MarkdownParser.MarkdownHtmlParser
,XdocParser
,Xhtml1BaseParser
,Xhtml5BaseParser
,Xhtml5Parser
public interface Parser
A 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
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Text parser typestatic final int
Unknown parser typestatic final int
XML parser type -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSinkWrapperFactory
(SinkWrapperFactory factory) Registers a givenSinkWrapperFactory
with the parser used in subsequent calls ofparse(...)
int
getType()
boolean
Returns whether anchors are automatically generated for each index entry found byIndexingSink
or not.boolean
Does the parser emit Doxia comments event when comments found in source?void
Parses the given source model and emits Doxia events into the given sink.void
Parses the given source model and emits Doxia events into the given sink.void
setEmitAnchorsForIndexableEntries
(boolean emitAnchors) Determines whether to automatically generate anchors for each index entry found byIndexingSink
or not.void
setEmitComments
(boolean emitComments) When comments are found in source markup, emit comment Doxia events or just ignore?
-
Field Details
-
UNKNOWN_TYPE
static final int UNKNOWN_TYPEUnknown parser type- See Also:
-
TXT_TYPE
static final int TXT_TYPEText parser type- See Also:
-
XML_TYPE
static final int XML_TYPEXML parser type- See Also:
-
-
Method Details
-
parse
Parses 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. You could usenewReader
methods fromReaderFactory
.sink
- A sink that consumes the Doxia events.- Throws:
ParseException
- if the model could not be parsed.
-
parse
Parses the given source model and emits Doxia events into the given sink.- Parameters:
source
- not null reader that provides the source document. You could usenewReader
methods fromReaderFactory
.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
Registers a givenSinkWrapperFactory
with 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 byIndexingSink
or not. By default no anchors are generated.- Parameters:
emitAnchors
-true
to emit anchors otherwisefalse
(the default)- Since:
- 2.0.0
-
isEmitAnchorsForIndexableEntries
boolean isEmitAnchorsForIndexableEntries()Returns whether anchors are automatically generated for each index entry found byIndexingSink
or not.- Returns:
true
if anchors are emitted otherwisefalse
- Since:
- 2.0.0
-