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 java.lang.Object implements BlockParser
-
-
Field Summary
Fields Modifier and Type Field Description private booleanisClosedprivate MutableDataSetmutableData
-
Constructor Summary
Constructors Constructor Description AbstractBlockParser()
-
Method Summary
All Methods Instance Methods Concrete 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 parsersvoidfinalizeClosedBlock()Used to clean up and prepare for the next parsing run of the AbstractBlockParser for internal parser house keeping not for BlockParser implementorsBlockContentgetBlockContent()MutableDataHoldergetDataHolder()booleanisClosed()booleanisContainer()booleanisInterruptible()Allows block parsers to be interrupted by other block parsersbooleanisParagraphParser()booleanisPropagatingLastBlankLine(BlockParser lastMatchedBlockParser)should be overridden in BlockQuote, FencedCode and ListItembooleanisRawText()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 interfacevoidremoveBlankLines()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vladsch.flexmark.parser.block.BlockParser
closeBlock, getBlock, tryContinue
-
-
-
-
Field Detail
-
mutableData
private MutableDataSet mutableData
-
isClosed
private boolean isClosed
-
-
Method Detail
-
isClosed
public boolean isClosed()
- Specified by:
isClosedin interfaceBlockParser- Returns:
- true if the block is already closed.
-
isContainer
public boolean isContainer()
- Specified by:
isContainerin interfaceBlockParser- 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:BlockParserAllows block parsers to be interrupted by other block parsers- Specified by:
isInterruptiblein interfaceBlockParser- Returns:
- true if block starts should be tried when this block parser is active
-
isRawText
public boolean isRawText()
Description copied from interface:BlockParserAllows block parsers to keep indenting spaces for those blocks that are interruptible but don't want indenting spaces removed.- Specified by:
isRawTextin interfaceBlockParser- Returns:
- true if block wants to keep indenting spaces
-
canContain
public boolean canContain(ParserState state, BlockParser blockParser, Block block)
- Specified by:
canContainin interfaceBlockParser- 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
-
isParagraphParser
public boolean isParagraphParser()
- Specified by:
isParagraphParserin interfaceBlockParser- 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:
isPropagatingLastBlankLinein interfaceBlockParser- 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:
getBlockContentin interfaceBlockParser- Returns:
- get the currently accumulated block content. May or may not be implemented by any parser except for the
ParagraphParseror one that returns true forBlockParser.isParagraphParser()
-
addLine
public void addLine(ParserState state, BasedSequence line)
Description copied from interface:BlockParserAdd another line to the block- Specified by:
addLinein interfaceBlockParser- Parameters:
state- parser stateline- line sequence
-
parseInlines
public void parseInlines(InlineParser inlineParser)
Description copied from interface:BlockParserDo inline processing for the block content using the given inline parser interface- Specified by:
parseInlinesin interfaceBlockParser- Parameters:
inlineParser- instance of inline parser
-
breakOutOnDoubleBlankLine
public boolean breakOutOnDoubleBlankLine()
- Specified by:
breakOutOnDoubleBlankLinein interfaceBlockParser- 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:BlockParserUsed to clean up and prepare for the next parsing run of the AbstractBlockParser for internal parser house keeping not for BlockParser implementors- Specified by:
finalizeClosedBlockin interfaceBlockParser
-
canInterruptBy
public boolean canInterruptBy(BlockParserFactory blockParserFactory)
Description copied from interface:BlockParserAllows block parsers to determine if they can be interrupted by other block parsers- Specified by:
canInterruptByin interfaceBlockParser- Parameters:
blockParserFactory- interrupting block parser- Returns:
- true if can interrupt.
-
getDataHolder
public MutableDataHolder getDataHolder()
- Specified by:
getDataHolderin interfaceBlockParser- Returns:
- the data holder for a block parser instance. Implemented by
AbstractBlockParser
-
removeBlankLines
public void removeBlankLines()
-
-