class Emphasis extends AbstractPass

Properties

protected Parser $parser from  AbstractPass
protected ParsedText $text from  AbstractPass
protected bool $closeEm
protected bool $closeStrong
protected int $emPos
protected int $emEndPos
protected int $remaining
protected int $strongPos
protected int $strongEndPos

Methods

__construct(Parser $parser, ParsedText $text)

No description

void
parse()

Parse the prepared text from stored parser

void
adjustEndingPositions()

Adjust the ending position of current EM and STRONG spans

void
adjustStartingPositions()

Adjust the starting position of current EM and STRONG spans

void
closeSpans()

End current valid EM and STRONG spans

void
parseEmphasisByCharacter(string $character, string $regexp)

Parse emphasis and strong applied using given character

array[]
getEmphasisByBlock(string $regexp, int $pos)

Get emphasis markup split by block

bool
ignoreEmphasis(int $matchPos, int $matchLen)

Test whether emphasis should be ignored at the given position in the text

void
openSpans(int $pos)

Open EM and STRONG spans whose content starts at given position

void
processEmphasisBlock(array $block)

Process a list of emphasis markup strings

void
processEmphasisMatch(int $matchPos, int $matchLen)

Process an emphasis mark

Details

in AbstractPass at line 29
__construct(Parser $parser, ParsedText $text)

No description

Parameters

Parser $parser
ParsedText $text

at line 50
void parse()

Parse the prepared text from stored parser

Return Value

void

at line 61
protected void adjustEndingPositions()

Adjust the ending position of current EM and STRONG spans

Return Value

void

at line 85
protected void adjustStartingPositions()

Adjust the starting position of current EM and STRONG spans

If both EM and STRONG are set to start at the same position, we adjust their position to match the order they are closed. If they start and end at the same position, STRONG starts before EM to match Markdown's behaviour

Return Value

void

at line 105
protected void closeSpans()

End current valid EM and STRONG spans

Return Value

void

at line 128
protected void parseEmphasisByCharacter(string $character, string $regexp)

Parse emphasis and strong applied using given character

Parameters

string $character

Markup character, either * or _

string $regexp

Regexp used to match the series of emphasis character

Return Value

void

at line 149
protected array[] getEmphasisByBlock(string $regexp, int $pos)

Get emphasis markup split by block

Parameters

string $regexp

Regexp used to match emphasis

int $pos

Position in the text of the first emphasis character

Return Value

array[]

Each array contains a list of [matchPos, matchLen] pairs

at line 187
protected bool ignoreEmphasis(int $matchPos, int $matchLen)

Test whether emphasis should be ignored at the given position in the text

Parameters

int $matchPos

Position of the emphasis in the text

int $matchLen

Length of the emphasis

Return Value

bool

at line 199
protected void openSpans(int $pos)

Open EM and STRONG spans whose content starts at given position

Parameters

int $pos

Return Value

void

at line 217
protected void processEmphasisBlock(array $block)

Process a list of emphasis markup strings

Parameters

array $block

List of [matchPos, matchLen] pairs

Return Value

void

at line 234
protected void processEmphasisMatch(int $matchPos, int $matchLen)

Process an emphasis mark

Parameters

int $matchPos
int $matchLen

Return Value

void