Class SubscriptDelimiterProcessor
java.lang.Object
com.vladsch.flexmark.ext.gfm.strikethrough.internal.SubscriptDelimiterProcessor
- All Implemented Interfaces:
DelimiterProcessor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canBeCloser
(String before, String after, boolean leftFlanking, boolean rightFlanking, boolean beforeIsPunctuation, boolean afterIsPunctuation, boolean beforeIsWhitespace, boolean afterIsWhiteSpace) Decide whether this delimiter can be a close delimiterboolean
canBeOpener
(String before, String after, boolean leftFlanking, boolean rightFlanking, boolean beforeIsPunctuation, boolean afterIsPunctuation, boolean beforeIsWhitespace, boolean afterIsWhiteSpace) Decide whether this delimiter can be an open delimiterchar
int
getDelimiterUse
(DelimiterRun opener, DelimiterRun closer) Determine how many (if any) of the delimiter characters should be used.int
char
void
Process the matched delimiters, e.g.boolean
Whether to skip delimiters that cannot be openers or closersunmatchedDelimiterNode
(InlineParser inlineParser, DelimiterRun delimiter) Allow delimiter processor to substitute unmatched delimiters by custom nodes
-
Constructor Details
-
SubscriptDelimiterProcessor
public SubscriptDelimiterProcessor()
-
-
Method Details
-
getOpeningCharacter
public char getOpeningCharacter()- Specified by:
getOpeningCharacter
in interfaceDelimiterProcessor
- Returns:
- the character that marks the beginning of a delimited node, must not clash with any built-in special characters
-
getClosingCharacter
public char getClosingCharacter()- Specified by:
getClosingCharacter
in interfaceDelimiterProcessor
- Returns:
- the character that marks the the ending of a delimited node, must not clash with any built-in special characters. Note that for a symmetric delimiter such as "*", this is the same as the opening.
-
getMinLength
public int getMinLength()- Specified by:
getMinLength
in interfaceDelimiterProcessor
- Returns:
- Minimum number of delimiter characters that are needed to activate this. Must be at least 1.
-
canBeOpener
public boolean canBeOpener(String before, String after, boolean leftFlanking, boolean rightFlanking, boolean beforeIsPunctuation, boolean afterIsPunctuation, boolean beforeIsWhitespace, boolean afterIsWhiteSpace) Description copied from interface:DelimiterProcessor
Decide whether this delimiter can be an open delimiter- Specified by:
canBeOpener
in interfaceDelimiterProcessor
- Parameters:
before
- string before delimiter or '\n' if noneafter
- string after delimiter or '\n' if noneleftFlanking
- is left flanking delimiterrightFlanking
- is right flanking delimiterbeforeIsPunctuation
- is punctuation beforeafterIsPunctuation
- is punctuation afterbeforeIsWhitespace
- is whitespace beforeafterIsWhiteSpace
- is whitespace after- Returns:
- true if can be open delimiter
-
canBeCloser
public boolean canBeCloser(String before, String after, boolean leftFlanking, boolean rightFlanking, boolean beforeIsPunctuation, boolean afterIsPunctuation, boolean beforeIsWhitespace, boolean afterIsWhiteSpace) Description copied from interface:DelimiterProcessor
Decide whether this delimiter can be a close delimiter- Specified by:
canBeCloser
in interfaceDelimiterProcessor
- Parameters:
before
- string before delimiter or '\n' if noneafter
- string after delimiter or '\n' if noneleftFlanking
- is left flanking delimiterrightFlanking
- is right flanking delimiterbeforeIsPunctuation
- is punctuation beforeafterIsPunctuation
- is punctuation afterbeforeIsWhitespace
- is whitespace beforeafterIsWhiteSpace
- is whitespace after- Returns:
- true if can be open delimiter
-
skipNonOpenerCloser
public boolean skipNonOpenerCloser()Description copied from interface:DelimiterProcessor
Whether to skip delimiters that cannot be openers or closers- Specified by:
skipNonOpenerCloser
in interfaceDelimiterProcessor
- Returns:
- true if to skip
-
unmatchedDelimiterNode
Description copied from interface:DelimiterProcessor
Allow delimiter processor to substitute unmatched delimiters by custom nodes- Specified by:
unmatchedDelimiterNode
in interfaceDelimiterProcessor
- Parameters:
inlineParser
- inline parser instancedelimiter
- delimiter run that was not matched- Returns:
- node to replace unmatched delimiter, null or delimiter.getNode() to replace with delimiter text
-
getDelimiterUse
Description copied from interface:DelimiterProcessor
Determine how many (if any) of the delimiter characters should be used.This allows implementations to decide how many characters to use based on the properties of the delimiter runs. An implementation can also return 0 when it doesn't want to allow this particular combination of delimiter runs.
- Specified by:
getDelimiterUse
in interfaceDelimiterProcessor
- Parameters:
opener
- the opening delimiter runcloser
- the closing delimiter run- Returns:
- how many delimiters should be used; must not be greater than length of either opener or closer
-
process
Description copied from interface:DelimiterProcessor
Process the matched delimiters, e.g. by wrapping the nodes between opener and closer in a new node, or appending a new node after the opener.Note that removal of the delimiter from the delimiter nodes and unlinking them is done by the caller.
- Specified by:
process
in interfaceDelimiterProcessor
- Parameters:
opener
- the delimiter with text node that contained the opening delimitercloser
- the delimiter with text node that contained the closing delimiterdelimitersUsed
- the number of delimiters that were used
-