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

An internal wiki link, like [[Foo]]. More...

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

Public Member Functions

 __construct (string $text, Element $node, SiteConfig $siteConfig, string $type)
 
 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.
 

Static Protected Member Functions

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.
 

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.
 
- Public Attributes inherited from Wikimedia\Parsoid\Html2Wt\ConstrainedText\RegExpConstrainedText
 $prefixMatcher
 
 $suffixMatcher
 
- Public Attributes inherited from Wikimedia\Parsoid\Html2Wt\ConstrainedText\ConstrainedText
 $text
 
 $node
 
 $prefix
 
 $suffix
 
 $selser
 
 $noSep
 
- Protected Member Functions inherited from Wikimedia\Parsoid\Html2Wt\ConstrainedText\RegExpConstrainedText
 __construct (array $args)
 

Detailed Description

An internal wiki link, like [[Foo]].

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Parsoid\Html2Wt\ConstrainedText\WikiLinkText::__construct ( string  $text,
Element  $node,
SiteConfig  $siteConfig,
string  $type 
)
Parameters
string$text
Element$node
SiteConfig$siteConfig
string$typeThe type of the link, as described by the rel attribute.

Member Function Documentation

◆ escape()

Wikimedia\Parsoid\Html2Wt\ConstrainedText\WikiLinkText::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\RegExpConstrainedText.

◆ fromSelSerImpl()

static Wikimedia\Parsoid\Html2Wt\ConstrainedText\WikiLinkText::fromSelSerImpl ( string  $text,
Element  $node,
DataParsoid  $dataParsoid,
Env  $env,
array  $opts 
)
staticprotected

Base case: the given node type does not correspond to a special ConstrainedText subclass.

We still have to be careful: the leftmost (rightmost) children of node may still be exposed to our left (right) context. If so (ie, their DSR bounds coincide) split the selser text and emit multiple ConstrainedText chunks to preserve the proper boundary conditions.

Parameters
string$text
Element$node
DataParsoid$dataParsoid
Env$env
array$opts
Returns
ConstrainedText|ConstrainedText[]

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


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