Class ParagraphBlockParser

  • All Implemented Interfaces:
    BlockParser

    public class ParagraphBlockParser
    extends java.lang.Object
    implements BlockParser

    ParagraphBlockParser class.

    Version:
    $Id$
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accept​(java.lang.String line, ByLineSource source)
      accept.
      private java.lang.String appendUntilEmptyLine​(java.lang.String line, ByLineSource source)
      Slurp lines from the source starting with the given line appending them together into a StringBuilder until an empty line is reached, and while the source contains more lines.
      Block visit​(java.lang.String line, ByLineSource source)
      visit.
      Block visit​(java.lang.String line, ByLineSource source, boolean generateParagraphTags)
      Visit the Block.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ParagraphBlockParser

        public ParagraphBlockParser​(BlockParser[] parsers)

        Constructor for ParagraphBlockParser.

        Parameters:
        parsers - the parsers.
    • Method Detail

      • accept

        public boolean accept​(java.lang.String line,
                              ByLineSource source)
        accept.
        Specified by:
        accept in interface BlockParser
        Parameters:
        line - the line.
        source - the source.
        Returns:
        boolean true if valid.
      • visit

        public Block visit​(java.lang.String line,
                           ByLineSource source,
                           boolean generateParagraphTags)
                    throws ParseException
        Visit the Block.
        Parameters:
        line - the line to visit.
        source - the source.
        generateParagraphTags - whether to generate a paragraph.
        Returns:
        the visited Block.
        Throws:
        ParseException - if any
      • appendUntilEmptyLine

        private java.lang.String appendUntilEmptyLine​(java.lang.String line,
                                                      ByLineSource source)
                                               throws ParseException
        Slurp lines from the source starting with the given line appending them together into a StringBuilder until an empty line is reached, and while the source contains more lines. The result can be passed to the #getBlocks(String) method.
        Parameters:
        line - the first line
        source - the source to read new lines from
        Returns:
        a StringBuilder appended with lines
        Throws:
        ParseException