Class FormatedTextParser

java.lang.Object
org.apache.maven.doxia.module.twiki.parser.FormatedTextParser

public class FormatedTextParser extends Object
Parse looking for formated text (bold, italic, ...)
  • Field Details

    • textParser

      private TextParser textParser
      parser used to parse text...
    • FACTORY_MAP

      private static final Map<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 String[] SPECIAL_CHAR
      format characters
  • Constructor Details

    • FormatedTextParser

      public FormatedTextParser()
  • Method Details

    • parse

      final Block[] parse(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 List<Block> parseFormat(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 use TextParser with the formatTextParser.