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

Static Public Member Functions

static isValidSep (string $sep)
 
static hasValidTagWidths (?DomSourceRange $dsr)
 
static getAttributeKVArray (Element $node)
 Get the attributes on a node in an array of KV objects.
 
static mkTagTk (Element $node)
 Create a TagTk corresponding to a DOM node.
 
static mkEndTagTk (Element $node)
 Create a EndTagTk corresponding to a DOM node.
 
static getShadowInfo (Element $node, string $name, ?string $curVal)
 For new elements, attrs are always considered modified.
 
static getAttributeShadowInfo (Element $node, string $name)
 Get shadowed information about an attribute on a node.
 
static commentWT (string $comment)
 
static nextToDeletedBlockNodeInWT (?Node $origNode, bool $before)
 In wikitext, did origNode occur next to a block node which has been deleted? While looking for next, we look past DOM nodes that are transparent in rendering.
 
static precedingSpaceSuppressesIndentPre (Node $node, Node $sepNode)
 Check if whitespace preceding this node would NOT trigger an indent-pre.
 
static traceNodeName (Node $node)
 
static origSrcValidInEditedContext (SerializerState $state, Node $node)
 In selser mode, check if an unedited node's wikitext from source wikitext is reusable as is.
 
static getAttrFromDataMw (DataMw $dataMw, string $key, bool $keep)
 FIXME: This method should probably be moved to DOMDataUtils class since it is used by both html2wt and wt2html code.
 
static escapeNowikiTags (string $text)
 Escape <nowiki> tags.
 

Member Function Documentation

◆ escapeNowikiTags()

static Wikimedia\Parsoid\Html2Wt\WTSUtils::escapeNowikiTags ( string $text)
static

Escape <nowiki> tags.

Parameters
string$text
Returns
string

◆ getAttrFromDataMw()

static Wikimedia\Parsoid\Html2Wt\WTSUtils::getAttrFromDataMw ( DataMw $dataMw,
string $key,
bool $keep )
static

FIXME: This method should probably be moved to DOMDataUtils class since it is used by both html2wt and wt2html code.

Parameters
DataMw$dataMw
string$key
bool$keep
Returns
?DataMwAttrib

◆ getAttributeKVArray()

static Wikimedia\Parsoid\Html2Wt\WTSUtils::getAttributeKVArray ( Element $node)
static

Get the attributes on a node in an array of KV objects.

Parameters
Element$node
Returns
KV[]

◆ getAttributeShadowInfo()

static Wikimedia\Parsoid\Html2Wt\WTSUtils::getAttributeShadowInfo ( Element $node,
string $name )
static

Get shadowed information about an attribute on a node.

Returns array with data: [ value => mixed, modified => bool (If the value of the attribute changed since we parsed the wikitext), fromsrc => bool (Whether we got the value from source-based roundtripping) ]

Parameters
Element$node
string$name
Returns
array

◆ getShadowInfo()

static Wikimedia\Parsoid\Html2Wt\WTSUtils::getShadowInfo ( Element $node,
string $name,
?string $curVal )
static

For new elements, attrs are always considered modified.

However, For old elements, we only consider an attribute modified if we have shadow info for it and it doesn't match the current value. Returns array with data: [ value => mixed, modified => bool (If the value of the attribute changed since we parsed the wikitext), fromsrc => bool (Whether we got the value from source-based roundtripping) ]

Parameters
Element$node
string$name
?string$curVal
Returns
array

◆ mkEndTagTk()

static Wikimedia\Parsoid\Html2Wt\WTSUtils::mkEndTagTk ( Element $node)
static

Create a EndTagTk corresponding to a DOM node.

Parameters
Element$node
Returns
EndTagTk

◆ mkTagTk()

static Wikimedia\Parsoid\Html2Wt\WTSUtils::mkTagTk ( Element $node)
static

Create a TagTk corresponding to a DOM node.

Parameters
Element$node
Returns
TagTk

◆ nextToDeletedBlockNodeInWT()

static Wikimedia\Parsoid\Html2Wt\WTSUtils::nextToDeletedBlockNodeInWT ( ?Node $origNode,
bool $before )
static

In wikitext, did origNode occur next to a block node which has been deleted? While looking for next, we look past DOM nodes that are transparent in rendering.

(See emitsSolTransparentSingleLineWT for which nodes.)

Parameters
?Node$origNode
bool$before
Returns
bool

◆ origSrcValidInEditedContext()

static Wikimedia\Parsoid\Html2Wt\WTSUtils::origSrcValidInEditedContext ( SerializerState $state,
Node $node )
static

In selser mode, check if an unedited node's wikitext from source wikitext is reusable as is.

Parameters
SerializerState$state
Node$node
Returns
bool

◆ precedingSpaceSuppressesIndentPre()

static Wikimedia\Parsoid\Html2Wt\WTSUtils::precedingSpaceSuppressesIndentPre ( Node $node,
Node $sepNode )
static

Check if whitespace preceding this node would NOT trigger an indent-pre.

Parameters
Node$node
Node$sepNode
Returns
bool

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