Parsoid
A bidirectional parser between wikitext and HTML5
Loading...
Searching...
No Matches
Wikimedia\Parsoid\Fragments\ExtTagPFragment Class Reference

An atomic fragment representing an extension tag encountered during preprocessing. More...

+ Inheritance diagram for Wikimedia\Parsoid\Fragments\ExtTagPFragment:
+ Collaboration diagram for Wikimedia\Parsoid\Fragments\ExtTagPFragment:

Public Member Functions

 __construct (public string|PFragment $wt, public LinkTarget $title,)
 
 asDom (ParsoidExtensionAPI $extApi, bool $release=false)
 Return the fragment as a (prepared and loaded) DOM DocumentFragment belonging to the Parsoid top-level document.If $release is true, then this PFragment will become invalid after this method returns.
Note
The default implementation of asDom() calls asHtmlString(). Subclassses must implement either asDom() or asHtmlString() to avoid infinite mutual recursion.

 
 toJsonArray ()
 
- Public Member Functions inherited from Wikimedia\Parsoid\Fragments\PFragment
 isEmpty ()
 Returns true if this fragment is empty.
 
 isAtomic ()
 Returns true if this fragment contains no wikitext elements; that is, if ::asMarkedWikitext() given an empty strip state would return a single strip marker and add a single item to the strip state (representing $this).
 
 isValid ()
 As an optimization to avoid unnecessary copying, certain operations on fragments may be destructive or lead to aliasing.
 
 getSrcOffsets ()
 Return the region of the source document that corresponds to this fragment.
 
 asHtmlString (ParsoidExtensionAPI $extApi)
 Return the fragment as a string of HTML.
 
 asMarkedWikitext (StripState $stripState)
 This method returns a "wikitext string" in the legacy format.
 
 containsMarker ()
 Returns true if this fragment contains some non-wikitext content.
 
 split ()
 Split this fragment at its strip markers and return an array which alternates between string items and PFragment items.
 
 killMarkers ()
 Return a version of this fragment with all non-wikitext content removed.
 
 markerSkipCallback (callable $callback)
 Call a callback function on all regions of the given text that are wikitext content, replacing them with the return value of the callback.
 
 trim ()
 Trim leading and trailing wikitext whitespace from this fragment.
 
 expand (ParsoidExtensionAPI $extApi, ?bool &$error=null)
 Expand templates, extension tags, and parser functions in a fragment.
 
 toRawText (ParsoidExtensionAPI $extApi)
 Return the 'raw text' of this fragment.
 

Static Public Member Functions

static newFromJsonArray (array $json)
 
Exceptions
JsonException

 
static jsonClassHintFor (string $keyName)
 
- Static Public Member Functions inherited from Wikimedia\Parsoid\Fragments\PFragment
static fromSplitWt (array $pieces, ?DomSourceRange $srcOffset=null)
 Helper function to create a new fragment from a mixed array of strings and fragments.
 
static registerFragmentClass (string $className)
 Register a fragment type with the JSON deserialization code.
 
static hint ()
 

Public Attributes

const TYPE_HINT = 'exttag'
 

Additional Inherited Members

- Protected Member Functions inherited from Wikimedia\Parsoid\Fragments\PFragment
 __construct (?DomSourceRange $srcOffsets)
 
- Static Protected Member Functions inherited from Wikimedia\Parsoid\Fragments\PFragment
static joinSourceRange (?DomSourceRange $first, ?DomSourceRange $second)
 Helper function to append two source ranges.
 
- Protected Attributes inherited from Wikimedia\Parsoid\Fragments\PFragment
DomSourceRange $srcOffsets
 The original wikitext source range for this fragment, or null for synthetic content that corresponds to no part of the original authored text.
 
- Static Protected Attributes inherited from Wikimedia\Parsoid\Fragments\PFragment
static array $FRAGMENT_TYPES
 

Detailed Description

An atomic fragment representing an extension tag encountered during preprocessing.

The arguments and body of the extension tag have all potentially been preprocessed into wikitext and fragments, since they may have contained strip markers as well. We also return the frame "title" at the point where the extension tag was encountered, so that we can properly set up the frame for its eventual expansion.

Member Function Documentation

◆ asDom()

Wikimedia\Parsoid\Fragments\ExtTagPFragment::asDom ( ParsoidExtensionAPI $extApi,
bool $release = false )

Return the fragment as a (prepared and loaded) DOM DocumentFragment belonging to the Parsoid top-level document.If $release is true, then this PFragment will become invalid after this method returns.

Note
The default implementation of asDom() calls asHtmlString(). Subclassses must implement either asDom() or asHtmlString() to avoid infinite mutual recursion.

Reimplemented from Wikimedia\Parsoid\Fragments\PFragment.

◆ jsonClassHintFor()

static Wikimedia\Parsoid\Fragments\ExtTagPFragment::jsonClassHintFor ( string $keyName)
static

◆ newFromJsonArray()

static Wikimedia\Parsoid\Fragments\ExtTagPFragment::newFromJsonArray ( array $json)
static

Exceptions
JsonException

Reimplemented from Wikimedia\Parsoid\Fragments\PFragment.

◆ toJsonArray()

Wikimedia\Parsoid\Fragments\ExtTagPFragment::toJsonArray ( )

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