org.apache.maven.doxia.module.twiki
Class TWikiParser

java.lang.Object
  extended by org.apache.maven.doxia.parser.AbstractParser
      extended by org.apache.maven.doxia.parser.AbstractTextParser
          extended by org.apache.maven.doxia.module.twiki.TWikiParser
All Implemented Interfaces:
LogEnabled, Markup, TextMarkup, Parser

public class TWikiParser
extends AbstractTextParser

Parse the twiki file format

Since:
1.0
Version:
$Id: TWikiParser.java 1090706 2011-04-09 23:15:28Z hboutemy $
Author:
Juan F. Codagnone
Plexus component:
role:
"org.apache.maven.doxia.parser.Parser"
role-hint:
"twiki"

Field Summary
 
Fields inherited from interface org.apache.maven.doxia.markup.TextMarkup
PIPE
 
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
 
Constructor Summary
TWikiParser()
          Creates the TWikiParser.
 
Method Summary
 String getTitle(List<Block> blocks, ByLineSource source)
          Guess a title for the page.
protected  void init()
          Initialize the parser.
 List<Block> parse(ByLineSource source)
          parse.
 void parse(Reader source, Sink sink)
          Parses the given source model and emits Doxia events into the given sink.
 
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, isSecondParsing, parse, setSecondParsing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TWikiParser

public TWikiParser()
Creates the TWikiParser.

Method Detail

parse

public final 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 final void parse(Reader source,
                        Sink sink)
                 throws ParseException
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 use newReader methods from ReaderFactory.
sink - A sink that consumes the Doxia events.
Throws:
ParseException - if the model could not be parsed.

getTitle

public final String getTitle(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 from ByLineReaderSource.getName()

Parameters:
blocks - blocks to parse
source - source to parse
Returns:
a title for a page
Since:
1.1

init

protected void init()
Initialize the parser. This is called first by 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.

Overrides:
init in class AbstractParser


Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.