public abstract class AbstractParser extends java.lang.Object implements Parser
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
DOXIA_VERSION |
private boolean |
emitComments
Emit Doxia comment events when parsing comments?
|
private Log |
logger
Log instance.
|
private MacroManager |
macroManager |
private boolean |
secondParsing
Indicates that a second parsing is required.
|
ROLE, TXT_TYPE, UNKNOWN_TYPE, XML_TYPE
Constructor and Description |
---|
AbstractParser() |
Modifier and Type | Method and Description |
---|---|
protected static java.lang.String |
doxiaVersion()
The current Doxia version.
|
void |
enableLogging(Log log)
Enable a
Doxia logger for this Doxia component. |
void |
executeMacro(java.lang.String macroId,
MacroRequest request,
Sink sink)
Execute a macro on the given sink.
|
protected java.io.File |
getBasedir()
Deprecated.
this does not work in multi-module builds, see DOXIA-373
|
protected Log |
getLog()
Returns the current logger for this parser.
|
protected MacroManager |
getMacroManager()
Gets the current
MacroManager . |
int |
getType()
|
protected void |
init()
Initialize the parser.
|
boolean |
isEmitComments()
Does the parser emit Doxia comments event when comments found in source?
|
protected boolean |
isSecondParsing()
Indicates if we are currently parsing a second time.
|
void |
parse(java.io.Reader source,
Sink sink,
java.lang.String reference)
Parses the given source model and emits Doxia events into the given sink.
|
void |
parse(java.lang.String string,
Sink sink)
Convenience method to parse an arbitrary string and emit events into the given sink.
|
void |
setEmitComments(boolean emitComments)
When comments are found in source markup, emit comment Doxia events or just ignore?
|
void |
setSecondParsing(boolean second)
Set
secondParsing to true, if we need a second parsing. |
private boolean secondParsing
@Requirement private MacroManager macroManager
private Log logger
private boolean emitComments
private static final java.lang.String DOXIA_VERSION
public void setEmitComments(boolean emitComments)
Parser
setEmitComments
in interface Parser
emitComments
- true
(default value) to emit comment Doxia eventspublic boolean isEmitComments()
Parser
isEmitComments
in interface Parser
true
(default value) if comment Doxia events are emittedpublic void executeMacro(java.lang.String macroId, MacroRequest request, Sink sink) throws MacroExecutionException, MacroNotFoundException
macroId
- An id to lookup the macro.request
- The corresponding MacroRequest.sink
- The sink to receive the events.MacroExecutionException
- if an error occurred during execution.MacroNotFoundException
- if the macro could not be found.protected java.io.File getBasedir()
public void parse(java.lang.String string, Sink sink) throws ParseException
string
- A string that provides the source input.sink
- A sink that consumes the Doxia events.ParseException
- if the string could not be parsed.public void parse(java.io.Reader source, Sink sink, java.lang.String reference) throws ParseException
Parser
parse
in interface Parser
source
- not null reader that provides the source document.
You could use newReader
methods from ReaderFactory
.sink
- A sink that consumes the Doxia events.ParseException
- if the model could not be parsed.public void setSecondParsing(boolean second)
secondParsing
to true, if we need a second parsing.second
- True for second parsing.protected boolean isSecondParsing()
public void enableLogging(Log log)
Doxia
logger for this Doxia
component.enableLogging
in interface LogEnabled
log
- a Log.protected Log getLog()
protected MacroManager getMacroManager()
MacroManager
.MacroManager
.protected void init()
Parser.parse(java.io.Reader, org.apache.maven.doxia.sink.Sink)
and can be used
to set the parser into a clear state so it can be re-used.protected static java.lang.String doxiaVersion()