Class FormatedTextParser
- java.lang.Object
-
- org.apache.maven.doxia.module.twiki.parser.FormatedTextParser
-
public class FormatedTextParser extends java.lang.Object
Parse looking for formated text (bold, italic, ...)- Version:
- $Id$
-
-
Field Summary
Fields Modifier and Type Field Description private static FormatBlockFactory
BOLD_FACTORY
creates bold blocksprivate static FormatBlockFactory
BOLDITALIC_FACTORY
creates bold italic blocksprivate static FormatBlockFactory
BOLDMONO_FACTORY
creates bold monospace blocksprivate static java.util.Map<java.lang.String,FormatBlockFactory>
FACTORY_MAP
map used to create blocks dependening on the text formatprivate static FormatBlockFactory
ITALIC_FACTORY
creates italic blocksprivate static FormatBlockFactory
MONOSPACED_FACTORY
creates monospaced blocksprivate static java.lang.String[]
SPECIAL_CHAR
format charactersprivate TextParser
textParser
parser used to parse text...
-
Constructor Summary
Constructors Constructor Description FormatedTextParser()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
isParenthesis(char c)
(package private) static boolean
isSpace(char c)
(package private) static boolean
isSpecial(char c)
(package private) Block[]
parse(java.lang.String line)
private java.util.List<Block>
parseFormat(java.lang.String line)
Parse text format (bold, italic...)void
setTextParser(TextParser textParser)
Sets the formatTextParser.
-
-
-
Field Detail
-
textParser
private TextParser textParser
parser used to parse text...
-
FACTORY_MAP
private static final java.util.Map<java.lang.String,FormatBlockFactory> FACTORY_MAP
map used to create blocks dependening on the text format
-
BOLD_FACTORY
private static final FormatBlockFactory BOLD_FACTORY
creates bold blocks
-
ITALIC_FACTORY
private static final FormatBlockFactory ITALIC_FACTORY
creates italic blocks
-
MONOSPACED_FACTORY
private static final FormatBlockFactory MONOSPACED_FACTORY
creates monospaced blocks
-
BOLDITALIC_FACTORY
private static final FormatBlockFactory BOLDITALIC_FACTORY
creates bold italic blocks
-
BOLDMONO_FACTORY
private static final FormatBlockFactory BOLDMONO_FACTORY
creates bold monospace blocks
-
SPECIAL_CHAR
private static final java.lang.String[] SPECIAL_CHAR
format characters
-
-
Method Detail
-
parse
final Block[] parse(java.lang.String line)
- Parameters:
line
- line to parse- Returns:
- TextBlock, ItalicBlock, BoldBlock, MonospacedBlock, ...
-
isSpace
static boolean isSpace(char c)
- Parameters:
c
- character to test- Returns:
true
if c is a space character
-
isSpecial
static boolean isSpecial(char c)
- Parameters:
c
- character to test- Returns:
true
if c is a character that limits the formats
-
parseFormat
private java.util.List<Block> parseFormat(java.lang.String line)
Parse text format (bold, italic...) TODO too many lines!!- Parameters:
line
- line to parse- Returns:
- list of blocks
-
isParenthesis
private boolean isParenthesis(char c)
- Parameters:
c
- character to test- Returns:
true
if c is a parenthesis
-
setTextParser
public final void setTextParser(TextParser textParser)
Sets the formatTextParser.- Parameters:
textParser
- text parser to useTextParser
with the formatTextParser.
-
-