public abstract class AbstractParser extends Object implements Parser
ROLE, TXT_TYPE, UNKNOWN_TYPE, XML_TYPE
Constructor and Description |
---|
AbstractParser() |
Modifier and Type | Method and Description |
---|---|
protected static String |
doxiaVersion()
The current Doxia version.
|
void |
enableLogging(Log log) |
void |
executeMacro(String macroId,
MacroRequest request,
Sink sink)
Execute a macro on the given sink.
|
protected 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()
isEmitComments.
|
protected boolean |
isSecondParsing()
Indicates if we are currently parsing a second time.
|
void |
parse(Reader source,
Sink sink)
Parses the given source model and emits Doxia events into the given sink.
|
void |
parse(String string,
Sink sink)
Convenience method to parse an arbitrary string and emit events into the given sink.
|
void |
parse(String string,
Sink sink,
String reference)
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. |
public AbstractParser()
public void setEmitComments(boolean emitComments)
setEmitComments
in interface Parser
emitComments
- true
(default value) to emit comment Doxia eventspublic boolean isEmitComments()
isEmitComments.
isEmitComments
in interface Parser
public void executeMacro(String macroId, MacroRequest request, Sink sink) throws MacroExecutionException, MacroNotFoundException
macroId
- an id to lookup the macrorequest
- the corresponding MacroRequestsink
- the sink to receive the eventsMacroExecutionException
- if an error occurred during executionMacroNotFoundException
- if the macro could not be foundprotected File getBasedir()
public void parse(String string, Sink sink) throws ParseException
string
- a string that provides the source inputsink
- a sink that consumes the Doxia eventsParseException
- if the string could not be parsedpublic void parse(String string, Sink sink, String reference) throws ParseException
string
- a string that provides the source inputsink
- a sink that consumes the Doxia eventsreference
- a string containing the reference to the source of the input string (e.g. filename)ParseException
- if the string could not be parsedpublic void parse(Reader source, Sink sink) throws ParseException
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 parsingprotected boolean isSecondParsing()
public void enableLogging(Log log)
enableLogging
in interface LogEnabled
protected Log getLog()
protected MacroManager getMacroManager()
MacroManager
.MacroManager
protected void init()
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 String doxiaVersion()
Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.