Top Fields Constructors Methods
com.vladsch.flexmark.parser.core.delimiter

public abstract Class EmphasisDelimiterProcessor

extends Object
implements DelimiterProcessor
Class Inheritance
All Implemented Interfaces
com.vladsch.flexmark.parser.delimiter.DelimiterProcessor
Known Direct Subclasses
com.vladsch.flexmark.parser.core.delimiter.UnderscoreDelimiterProcessor, com.vladsch.flexmark.parser.core.delimiter.AsteriskDelimiterProcessor
Imports
com.vladsch.flexmark.ast.Emphasis, .StrongEmphasis, com.vladsch.flexmark.parser.InlineParser, com.vladsch.flexmark.parser.delimiter.DelimiterProcessor, .DelimiterRun, com.vladsch.flexmark.util.ast.DelimitedNode, .Node, com.vladsch.flexmark.util.misc.Utils, com.vladsch.flexmark.util.sequence.BasedSequence

Field Summary

Modifier and TypeField and Description
private final char
private final int

Constructor Summary

AccessConstructor and Description
protected
EmphasisDelimiterProcessor(char delimiterChar, boolean strongWrapsEmphasis)

Method Summary

Modifier and TypeMethod and Description
public boolean
canBeCloser(String
string before delimiter or '\n' if none
before
,
String
string after delimiter or '\n' if none
after
,
boolean
is left flanking delimiter
leftFlanking
,
boolean
is right flanking delimiter
rightFlanking
,
boolean
is punctuation before
beforeIsPunctuation
,
boolean
is punctuation after
afterIsPunctuation
,
boolean
is whitespace before
beforeIsWhitespace
,
boolean
is whitespace after
afterIsWhiteSpace
)

Implements com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.canBeCloser.

Decide whether this delimiter can be a close delimiter

public boolean
canBeOpener(String
string before delimiter or '\n' if none
before
,
String
string after delimiter or '\n' if none
after
,
boolean
is left flanking delimiter
leftFlanking
,
boolean
is right flanking delimiter
rightFlanking
,
boolean
is punctuation before
beforeIsPunctuation
,
boolean
is punctuation after
afterIsPunctuation
,
boolean
is whitespace before
beforeIsWhitespace
,
boolean
is whitespace after
afterIsWhiteSpace
)

Implements com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.canBeOpener.

Decide whether this delimiter can be an open delimiter

public char
public int
getDelimiterUse(DelimiterRun
the opening delimiter run
opener
,
DelimiterRun
the closing delimiter run
closer
)

Implements com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.getDelimiterUse.

Determine how many (if any) of the delimiter characters should be used.

public int
public char
public void
process(Delimiter
the delimiter with text node that contained the opening delimiter
opener
,
Delimiter
the delimiter with text node that contained the closing delimiter
closer
,
int
the number of delimiters that were used
delimitersUsed
)

Implements com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.process.

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.

public boolean
skipNonOpenerCloser()

Implements com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.skipNonOpenerCloser.

Whether to skip delimiters that cannot be openers or closers

public Node
unmatchedDelimiterNode(InlineParser
inline parser instance
inlineParser
,
DelimiterRun
delimiter run that was not matched
delimiter
)

Implements com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.unmatchedDelimiterNode.

Allow delimiter processor to substitute unmatched delimiters by custom nodes

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delimiterCharback to summary
private final char delimiterChar
multipleUseback to summary
private final int multipleUse

Constructor Detail

EmphasisDelimiterProcessorback to summary
protected EmphasisDelimiterProcessor(char delimiterChar, boolean strongWrapsEmphasis)

Method Detail

canBeCloserback to summary
public boolean canBeCloser(String before, String after, boolean leftFlanking, boolean rightFlanking, boolean beforeIsPunctuation, boolean afterIsPunctuation, boolean beforeIsWhitespace, boolean afterIsWhiteSpace)

Implements com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.canBeCloser.

Doc from com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.canBeCloser.

Decide whether this delimiter can be a close delimiter

Parameters
before:String

string before delimiter or '\n' if none

after:String

string after delimiter or '\n' if none

leftFlanking:boolean

is left flanking delimiter

rightFlanking:boolean

is right flanking delimiter

beforeIsPunctuation:boolean

is punctuation before

afterIsPunctuation:boolean

is punctuation after

beforeIsWhitespace:boolean

is whitespace before

afterIsWhiteSpace:boolean

is whitespace after

Returns:boolean

true if can be open delimiter

Annotations
@Override
canBeOpenerback to summary
public boolean canBeOpener(String before, String after, boolean leftFlanking, boolean rightFlanking, boolean beforeIsPunctuation, boolean afterIsPunctuation, boolean beforeIsWhitespace, boolean afterIsWhiteSpace)

Implements com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.canBeOpener.

Doc from com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.canBeOpener.

Decide whether this delimiter can be an open delimiter

Parameters
before:String

string before delimiter or '\n' if none

after:String

string after delimiter or '\n' if none

leftFlanking:boolean

is left flanking delimiter

rightFlanking:boolean

is right flanking delimiter

beforeIsPunctuation:boolean

is punctuation before

afterIsPunctuation:boolean

is punctuation after

beforeIsWhitespace:boolean

is whitespace before

afterIsWhiteSpace:boolean

is whitespace after

Returns:boolean

true if can be open delimiter

Annotations
@Override
getClosingCharacterback to summary
public char getClosingCharacter()

Implements com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.getClosingCharacter.

Returns:char

Doc from com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.getClosingCharacter.

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.

Annotations
@Override
getDelimiterUseback to summary
public int getDelimiterUse(DelimiterRun opener, DelimiterRun closer)

Implements com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.getDelimiterUse.

Doc from com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.getDelimiterUse.

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.

Parameters
opener:DelimiterRun

the opening delimiter run

closer:DelimiterRun

the closing delimiter run

Returns:int

how many delimiters should be used; must not be greater than length of either opener or closer

Annotations
@Override
getMinLengthback to summary
public int getMinLength()

Implements com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.getMinLength.

Returns:int

Doc from com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.getMinLength.

Minimum number of delimiter characters that are needed to activate this. Must be at least 1.

Annotations
@Override
getOpeningCharacterback to summary
public char getOpeningCharacter()

Implements com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.getOpeningCharacter.

Returns:char

Doc from com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.getOpeningCharacter.

the character that marks the beginning of a delimited node, must not clash with any built-in special characters

Annotations
@Override
processback to summary
public void process(Delimiter opener, Delimiter closer, int delimitersUsed)

Implements com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.process.

Doc from com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.process.

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.

Parameters
opener:Delimiter

the delimiter with text node that contained the opening delimiter

closer:Delimiter

the delimiter with text node that contained the closing delimiter

delimitersUsed:int

the number of delimiters that were used

Annotations
@Override
skipNonOpenerCloserback to summary
public boolean skipNonOpenerCloser()

Implements com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.skipNonOpenerCloser.

Doc from com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.skipNonOpenerCloser.

Whether to skip delimiters that cannot be openers or closers

Returns:boolean

true if to skip

Annotations
@Override
unmatchedDelimiterNodeback to summary
public Node unmatchedDelimiterNode(InlineParser inlineParser, DelimiterRun delimiter)

Implements com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.unmatchedDelimiterNode.

Doc from com.vladsch.flexmark.parser.delimiter.DelimiterProcessor.unmatchedDelimiterNode.

Allow delimiter processor to substitute unmatched delimiters by custom nodes

Parameters
inlineParser:InlineParser

inline parser instance

delimiter:DelimiterRun

delimiter run that was not matched

Returns:Node

node to replace unmatched delimiter, null or delimiter.getNode() to replace with delimiter text

Annotations
@Override