Class TWikiParser
- java.lang.Object
-
- org.apache.maven.doxia.parser.AbstractParser
-
- org.apache.maven.doxia.parser.AbstractTextParser
-
- org.apache.maven.doxia.module.twiki.TWikiParser
-
- All Implemented Interfaces:
LogEnabled
,Markup
,TextMarkup
,Parser
@Component(role=Parser.class, hint="twiki") public class TWikiParser extends AbstractTextParser
Parse the twiki file format- Since:
- 1.0
- Version:
- $Id$
-
-
Field Summary
Fields Modifier and Type Field Description private static int
EXTENSION_LENGTH
private FormatedTextParser
formatTextParser
Text parser.private HRuleBlockParser
hrulerParser
hruler parser.private GenericListBlockParser
listParser
enumeration parser.private ParagraphBlockParser
paraParser
paragraph parser.private BlockParser[]
parsers
list of parsers to try to apply to the toplevelprivate SectionBlockParser
sectionParser
section parser.private TableBlockParser
tableParser
table parser.private TextParser
textParser
text parser.private VerbatimBlockParser
verbatimParser
verbatim parser.-
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, STAR
-
Fields inherited from interface org.apache.maven.doxia.parser.Parser
ROLE, TXT_TYPE, UNKNOWN_TYPE, XML_TYPE
-
Fields inherited from interface org.apache.maven.doxia.markup.TextMarkup
PIPE
-
-
Constructor Summary
Constructors Constructor Description TWikiParser()
Creates the TWikiParser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getTitle(java.util.List<Block> blocks, ByLineSource source)
Guess a title for the page.protected void
init()
Initialize the parser.void
parse(java.io.Reader source, Sink sink)
Parses the given source model and emits Doxia events into the given sink.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.java.util.List<Block>
parse(ByLineSource source)
parse.-
Methods inherited from class org.apache.maven.doxia.parser.AbstractTextParser
getType
-
Methods inherited from class org.apache.maven.doxia.parser.AbstractParser
doxiaVersion, enableLogging, executeMacro, getBasedir, getLog, getMacroManager, isEmitComments, isSecondParsing, parse, setEmitComments, setSecondParsing
-
-
-
-
Field Detail
-
EXTENSION_LENGTH
private static final int EXTENSION_LENGTH
- See Also:
- Constant Field Values
-
paraParser
private final ParagraphBlockParser paraParser
paragraph parser.
-
sectionParser
private final SectionBlockParser sectionParser
section parser.
-
listParser
private final GenericListBlockParser listParser
enumeration parser.
-
formatTextParser
private final FormatedTextParser formatTextParser
Text parser.
-
textParser
private final TextParser textParser
text parser. This only works for xhtml output, but there is no way of transforming a wikiWord in another context.
-
hrulerParser
private final HRuleBlockParser hrulerParser
hruler parser.
-
tableParser
private final TableBlockParser tableParser
table parser.
-
verbatimParser
private final VerbatimBlockParser verbatimParser
verbatim parser.
-
parsers
private BlockParser[] parsers
list of parsers to try to apply to the toplevel
-
-
Method Detail
-
parse
public final java.util.List<Block> parse(ByLineSource source) throws ParseException
parse.
- Parameters:
source
- source to parse.- Returns:
- the blocks that represent source.
- Throws:
ParseException
- on error.
-
parse
public void parse(java.io.Reader source, Sink sink) throws ParseException
Description copied from interface:Parser
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.- Throws:
ParseException
- if the model could not be parsed.
-
parse
public final void parse(java.io.Reader source, Sink sink, java.lang.String reference) throws ParseException
Description copied from interface:Parser
Parses the given source model and emits Doxia events into the given sink.- Specified by:
parse
in interfaceParser
- Overrides:
parse
in classAbstractParser
- Parameters:
source
- not null reader that provides the source document. You could usenewReader
methods fromReaderFactory
.sink
- A sink that consumes the Doxia events.reference
- the reference- Throws:
ParseException
- if the model could not be parsed.
-
getTitle
public final java.lang.String getTitle(java.util.List<Block> blocks, ByLineSource source)
Guess a title for the page. It uses the first section that it finds. If it doesn't find any section tries to get it fromByLineReaderSource.getName()
- Parameters:
blocks
- blocks to parsesource
- source to parse- Returns:
- a title for a page
- Since:
- 1.1
-
init
protected void init()
Initialize the parser. This is called first byParser.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.- Overrides:
init
in classAbstractParser
-
-