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
-
-
Constructor Summary
Constructors Constructor Description AbstractBlockParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLine(ParserState state, BasedSequence line)
Add another line to the blockboolean
breakOutOnDoubleBlankLine()
boolean
canContain(ParserState state, BlockParser blockParser, Block block)
boolean
canInterruptBy(BlockParserFactory blockParserFactory)
Allows block parsers to determine if they can be interrupted by other block parsersvoid
finalizeClosedBlock()
Used to clean up and prepare for the next parsing run of the AbstractBlockParser for internal parser house keeping not for BlockParser implementorsBlockContent
getBlockContent()
MutableDataHolder
getDataHolder()
boolean
isClosed()
boolean
isContainer()
boolean
isInterruptible()
Allows block parsers to be interrupted by other block parsersboolean
isParagraphParser()
boolean
isPropagatingLastBlankLine(BlockParser lastMatchedBlockParser)
should be overridden in BlockQuote, FencedCode and ListItemboolean
isRawText()
Allows block parsers to keep indenting spaces for those blocks that are interruptible but don't want indenting spaces removed.void
parseInlines(InlineParser inlineParser)
Do inline processing for the block content using the given inline parser interfacevoid
removeBlankLines()
-
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
-
-
-
-
Method Detail
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interfaceBlockParser
- Returns:
- true if the block is already closed.
-
isContainer
public boolean isContainer()
- Specified by:
isContainer
in 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:BlockParser
Allows block parsers to be interrupted by other block parsers- Specified by:
isInterruptible
in interfaceBlockParser
- 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 interfaceBlockParser
- Returns:
- true if block wants to keep indenting spaces
-
canContain
public boolean canContain(ParserState state, BlockParser blockParser, Block block)
- Specified by:
canContain
in 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:
isParagraphParser
in 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:
isPropagatingLastBlankLine
in 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:
getBlockContent
in interfaceBlockParser
- 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 forBlockParser.isParagraphParser()
-
addLine
public void addLine(ParserState state, BasedSequence line)
Description copied from interface:BlockParser
Add another line to the block- Specified by:
addLine
in interfaceBlockParser
- Parameters:
state
- parser stateline
- 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 interfaceBlockParser
- Parameters:
inlineParser
- instance of inline parser
-
breakOutOnDoubleBlankLine
public boolean breakOutOnDoubleBlankLine()
- Specified by:
breakOutOnDoubleBlankLine
in 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: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 interfaceBlockParser
-
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 interfaceBlockParser
- Parameters:
blockParserFactory
- interrupting block parser- Returns:
- true if can interrupt.
-
getDataHolder
public MutableDataHolder getDataHolder()
- Specified by:
getDataHolder
in interfaceBlockParser
- Returns:
- the data holder for a block parser instance. Implemented by
AbstractBlockParser
-
removeBlankLines
public void removeBlankLines()
-
-