Interface BlockParser
-
- All Known Implementing Classes:
AbbreviationBlockParser,AbstractBlockParser,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 interface BlockParserParser for a specific block node.Implementations should subclass
AbstractBlockParserinstead of implementing this directly.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddLine(ParserState state, BasedSequence line)Add another line to the blockbooleanbreakOutOnDoubleBlankLine()booleancanContain(ParserState state, BlockParser blockParser, Block block)booleancanInterruptBy(BlockParserFactory blockParserFactory)Allows block parsers to determine if they can be interrupted by other block parsersvoidcloseBlock(ParserState state)voidfinalizeClosedBlock()Used to clean up and prepare for the next parsing run of the AbstractBlockParser for internal parser house keeping not for BlockParser implementorsBlockgetBlock()BlockContentgetBlockContent()MutableDataHoldergetDataHolder()booleanisClosed()booleanisContainer()booleanisInterruptible()Allows block parsers to be interrupted by other block parsersbooleanisParagraphParser()booleanisPropagatingLastBlankLine(BlockParser lastMatchedBlockParser)booleanisRawText()Allows block parsers to keep indenting spaces for those blocks that are interruptible but don't want indenting spaces removed.voidparseInlines(InlineParser inlineParser)Do inline processing for the block content using the given inline parser interfaceBlockContinuetryContinue(ParserState state)See if the block parser can continue parsing the current block
-
-
-
Method Detail
-
isContainer
boolean isContainer()
- Returns:
- true if the block that is parsed is a container (contains other blocks), or false if it's a leaf.
-
canContain
boolean canContain(ParserState state, BlockParser blockParser, Block block)
- Parameters:
state- parser stateblockParser- block parserblock- new block being started @return true if this block parser's block can contain the given block type, false if it cannot
-
getBlock
Block getBlock()
- Returns:
- the block parser's block node instance
-
tryContinue
BlockContinue tryContinue(ParserState state)
See if the block parser can continue parsing the current block- Parameters:
state- current parsing state- Returns:
- block continue instance
-
addLine
void addLine(ParserState state, BasedSequence line)
Add another line to the block- Parameters:
state- parser stateline- line sequence
-
closeBlock
void closeBlock(ParserState state)
-
isClosed
boolean isClosed()
- Returns:
- true if the block is already closed.
-
isPropagatingLastBlankLine
boolean isPropagatingLastBlankLine(BlockParser lastMatchedBlockParser)
- Parameters:
lastMatchedBlockParser- last matched block parser instance- Returns:
- true if the last blank line status should be propagated to parent blocks
-
breakOutOnDoubleBlankLine
boolean breakOutOnDoubleBlankLine()
- Returns:
- true if Double blank line should finalize this block parser and its children and reset to parent
-
isParagraphParser
boolean isParagraphParser()
- Returns:
- true if this block parser is the paragraph block parser
-
getBlockContent
BlockContent getBlockContent()
- Returns:
- get the currently accumulated block content. May or may not be implemented by any parser except for the
ParagraphParseror one that returns true forisParagraphParser()
-
finalizeClosedBlock
void finalizeClosedBlock()
Used to clean up and prepare for the next parsing run of the AbstractBlockParser for internal parser house keeping not for BlockParser implementors
-
parseInlines
void parseInlines(InlineParser inlineParser)
Do inline processing for the block content using the given inline parser interface- Parameters:
inlineParser- instance of inline parser
-
isInterruptible
boolean isInterruptible()
Allows block parsers to be interrupted by other block parsers- Returns:
- true if block starts should be tried when this block parser is active
-
isRawText
boolean isRawText()
Allows block parsers to keep indenting spaces for those blocks that are interruptible but don't want indenting spaces removed.- Returns:
- true if block wants to keep indenting spaces
-
canInterruptBy
boolean canInterruptBy(BlockParserFactory blockParserFactory)
Allows block parsers to determine if they can be interrupted by other block parsers- Parameters:
blockParserFactory- interrupting block parser- Returns:
- true if can interrupt.
-
getDataHolder
MutableDataHolder getDataHolder()
- Returns:
- the data holder for a block parser instance. Implemented by
AbstractBlockParser
-
-