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

All media should have a fixed structure: More...

Public Member Functions

 __construct (Element $mediaElt, ?Element $linkElt=null, ?Element $containerElt=null)
 
 isRedLink ()
 We were not able to fetch info for the title, so the media was considered missing and rendered as a span.
 
 getResource ()
 
 getAlt ()
 
 getMediaUrl ()
 

Static Public Member Functions

static parse (Node $node)
 

Public Attributes

 $containerElt
 
 $linkElt
 
 $mediaElt
 
 $captionElt
 

Detailed Description

All media should have a fixed structure:

<conatinerElt>
<linkElt><mediaElt /></linkElt>
<captionElt>...</captionElt>
</containerElt>

Pull out this fixed structure, being as generous as possible with possibly-broken HTML.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Parsoid\Core\MediaStructure::__construct ( Element $mediaElt,
?Element $linkElt = null,
?Element $containerElt = null )
Parameters
Element$mediaElt
?Element$linkElt
?Element$containerElt

Member Function Documentation

◆ getAlt()

Wikimedia\Parsoid\Core\MediaStructure::getAlt ( )
Returns
?string The alt text if it exists, otherwise null

◆ getMediaUrl()

Wikimedia\Parsoid\Core\MediaStructure::getMediaUrl ( )
Returns
?string The media href if it exists, otherwise null.

◆ getResource()

Wikimedia\Parsoid\Core\MediaStructure::getResource ( )
Returns
?string the resource name if it exists, otherwise null

◆ isRedLink()

Wikimedia\Parsoid\Core\MediaStructure::isRedLink ( )

We were not able to fetch info for the title, so the media was considered missing and rendered as a span.

Returns
bool

◆ parse()

static Wikimedia\Parsoid\Core\MediaStructure::parse ( Node $node)
static
Parameters
Node$node
Returns
?MediaStructure

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