Class AbstractBlockParser

java.lang.Object
com.vladsch.flexmark.parser.block.AbstractBlockParser
All Implemented Interfaces:
BlockParser
Direct Known Subclasses:
AbbreviationBlockParser, AdmonitionBlockParser, AsideBlockParser, BlockQuoteParser, DefinitionItemBlockParser, DocumentBlockParser, EnumeratedReferenceBlockParser, FencedCodeBlockParser, FootnoteBlockParser, GitLabBlockQuoteParser, HeadingParser, HtmlBlockParser, IndentedCodeBlockParser, JekyllFrontMatterBlockParser, JekyllTagBlockParser, ListBlockParser, ListItemParser, MacroBlockParser, MacroDefinitionBlockParser, ParagraphParser, SimTocBlockParser, SpecExampleBlockParser, ThematicBreakParser, TocBlockParser, YamlFrontMatterBlockParser, ZzzzzzBlockParser

public abstract class AbstractBlockParser extends Object implements BlockParser
  • Field Details

    • mutableData

      private MutableDataSet mutableData
    • isClosed

      private boolean isClosed
  • Constructor Details

    • AbstractBlockParser

      public AbstractBlockParser()
  • Method Details

    • isClosed

      public boolean isClosed()
      Specified by:
      isClosed in interface BlockParser
      Returns:
      true if the block is already closed.
    • isContainer

      public boolean isContainer()
      Specified by:
      isContainer in interface BlockParser
      Returns:
      true if the block that is parsed is a container (contains other blocks), or false if it's a leaf.
    • isInterruptible

      public boolean isInterruptible()
      Description copied from interface: BlockParser
      Allows block parsers to be interrupted by other block parsers
      Specified by:
      isInterruptible in interface BlockParser
      Returns:
      true if block starts should be tried when this block parser is active
    • isRawText

      public boolean isRawText()
      Description copied from interface: BlockParser
      Allows block parsers to keep indenting spaces for those blocks that are interruptible but don't want indenting spaces removed.
      Specified by:
      isRawText in interface BlockParser
      Returns:
      true if block wants to keep indenting spaces
    • canContain

      public boolean canContain(ParserState state, BlockParser blockParser, Block block)
      Specified by:
      canContain in interface BlockParser
      Parameters:
      state - parser state
      blockParser - block parser
      block - new block being started @return true if this block parser's block can contain the given block type, false if it cannot
    • isParagraphParser

      public boolean isParagraphParser()
      Specified by:
      isParagraphParser in interface BlockParser
      Returns:
      true if this block parser is the paragraph block parser
    • isPropagatingLastBlankLine

      public boolean isPropagatingLastBlankLine(BlockParser lastMatchedBlockParser)
      should be overridden in BlockQuote, FencedCode and ListItem
      Specified by:
      isPropagatingLastBlankLine in interface BlockParser
      Parameters:
      lastMatchedBlockParser - the last matched block parser instance
      Returns:
      true if the blank line should be propagated to parent
    • getBlockContent

      public BlockContent getBlockContent()
      Specified by:
      getBlockContent in interface BlockParser
      Returns:
      get the currently accumulated block content. May or may not be implemented by any parser except for the ParagraphParser or one that returns true for BlockParser.isParagraphParser()
    • addLine

      public void addLine(ParserState state, BasedSequence line)
      Description copied from interface: BlockParser
      Add another line to the block
      Specified by:
      addLine in interface BlockParser
      Parameters:
      state - parser state
      line - line sequence
    • parseInlines

      public void parseInlines(InlineParser inlineParser)
      Description copied from interface: BlockParser
      Do inline processing for the block content using the given inline parser interface
      Specified by:
      parseInlines in interface BlockParser
      Parameters:
      inlineParser - instance of inline parser
    • breakOutOnDoubleBlankLine

      public boolean breakOutOnDoubleBlankLine()
      Specified by:
      breakOutOnDoubleBlankLine in interface BlockParser
      Returns:
      true if Double blank line should finalize this block parser and its children and reset to parent
    • finalizeClosedBlock

      public final void finalizeClosedBlock()
      Description copied from interface: BlockParser
      Used to clean up and prepare for the next parsing run of the AbstractBlockParser for internal parser house keeping not for BlockParser implementors
      Specified by:
      finalizeClosedBlock in interface BlockParser
    • canInterruptBy

      public boolean canInterruptBy(BlockParserFactory blockParserFactory)
      Description copied from interface: BlockParser
      Allows block parsers to determine if they can be interrupted by other block parsers
      Specified by:
      canInterruptBy in interface BlockParser
      Parameters:
      blockParserFactory - interrupting block parser
      Returns:
      true if can interrupt.
    • getDataHolder

      public MutableDataHolder getDataHolder()
      Specified by:
      getDataHolder in interface BlockParser
      Returns:
      the data holder for a block parser instance. Implemented by AbstractBlockParser
    • removeBlankLines

      public void removeBlankLines()