Parsoid
A bidirectional parser between wikitext and HTML5
Loading...
Searching...
No Matches
Wikimedia\Parsoid\Html2Wt\ConstrainedText\RegExpConstrainedText Class Reference

This subclass allows specification of a regular expression for acceptable (or prohibited) leading (and/or trailing) contexts. More...

+ Inheritance diagram for Wikimedia\Parsoid\Html2Wt\ConstrainedText\RegExpConstrainedText:
+ Collaboration diagram for Wikimedia\Parsoid\Html2Wt\ConstrainedText\RegExpConstrainedText:

Public Member Functions

 escape (State $state)
 Use the provided state, which gives context and access to the entire list of chunks, to determine the proper escape prefix/suffix.Returns an object with a text property as well as optional prefix and 'suffix' properties giving desired escape strings.

Parameters
State$stateContext state
Returns
Result

 
- Public Member Functions inherited from Wikimedia\Parsoid\Html2Wt\ConstrainedText\ConstrainedText
 equals (ConstrainedText $ct)
 Simple equality.
 
 matches (string $re, Env $env)
 Useful shortcut: execute a regular expression on the raw wikitext.
 

Public Attributes

 $prefixMatcher
 
 $suffixMatcher
 
- Public Attributes inherited from Wikimedia\Parsoid\Html2Wt\ConstrainedText\ConstrainedText
 $text
 
 $node
 
 $prefix
 
 $suffix
 
 $selser
 
 $noSep
 

Protected Member Functions

 __construct (array $args)
 

Additional Inherited Members

- Static Public Member Functions inherited from Wikimedia\Parsoid\Html2Wt\ConstrainedText\ConstrainedText
static escapeLine (array $line)
 This adds necessary escapes to a line of chunks.
 
static cast ( $o, Node $node)
 Ensure that the argument o, which is perhaps a string, is a instance of ConstrainedText.
 
static fromSelSer (string $text, Element $node, DataParsoid $dataParsoid, Env $env, array $opts=[])
 SelSer support: when we come across an unmodified node in during selective serialization, we know we can use the original wikitext for that node unmodified.
 
- Static Protected Member Functions inherited from Wikimedia\Parsoid\Html2Wt\ConstrainedText\ConstrainedText
static fromSelSerImpl (string $text, Element $node, DataParsoid $dataParsoid, Env $env, array $opts)
 Base case: the given node type does not correspond to a special ConstrainedText subclass.
 

Detailed Description

This subclass allows specification of a regular expression for acceptable (or prohibited) leading (and/or trailing) contexts.

This is an abstract class; it's intended to be subclassed, not used directly, and so it not included in the lists of types tried by fromSelSer.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Parsoid\Html2Wt\ConstrainedText\RegExpConstrainedText::__construct ( array  $args)
protected
Parameters
array{text:string,node:Node,prefix?:string,suffix?:string}$args Options.

Reimplemented from Wikimedia\Parsoid\Html2Wt\ConstrainedText\ConstrainedText.

Member Function Documentation

◆ escape()

Wikimedia\Parsoid\Html2Wt\ConstrainedText\RegExpConstrainedText::escape ( State  $state)

Use the provided state, which gives context and access to the entire list of chunks, to determine the proper escape prefix/suffix.Returns an object with a text property as well as optional prefix and 'suffix' properties giving desired escape strings.

Parameters
State$stateContext state
Returns
Result

Reimplemented from Wikimedia\Parsoid\Html2Wt\ConstrainedText\ConstrainedText.

Reimplemented in Wikimedia\Parsoid\Html2Wt\ConstrainedText\AutoURLLinkText, and Wikimedia\Parsoid\Html2Wt\ConstrainedText\WikiLinkText.


The documentation for this class was generated from the following file: