Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4152435
ParserHookProcessor.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ParserHookProcessor.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Wikimedia\Parsoid\ParserTests
;
use
stdClass
;
use
Wikimedia\Parsoid\DOM\Element
;
use
Wikimedia\Parsoid\DOM\Node
;
use
Wikimedia\Parsoid\Ext\DOMDataUtils
;
use
Wikimedia\Parsoid\Ext\DOMProcessor
as
ExtDOMProcessor
;
use
Wikimedia\Parsoid\Ext\ParsoidExtensionAPI
;
use
Wikimedia\Parsoid\Utils\DOMUtils
;
/**
* See tests/parser/ParserTestParserHook.php in core.
*/
class
ParserHookProcessor
extends
ExtDOMProcessor
{
public
function
staticTagPostProcessor
(
Node
$node
,
stdClass
$obj
):
void
{
if
(
$node
instanceof
Element
)
{
if
(
DOMUtils
::
hasTypeOf
(
$node
,
'mw:Extension/statictag'
)
)
{
$dataMw
=
DOMDataUtils
::
getDataMw
(
$node
);
// T367616: ->attrs-> should be renamed to extAttrs
if
(
(
$dataMw
->
attrs
->
action
??
null
)
===
'flush'
)
{
$node
->
appendChild
(
$node
->
ownerDocument
->
createTextNode
(
$obj
->
buf
)
);
$obj
->
buf
=
''
;
}
else
{
$obj
->
buf
.=
$dataMw
->
body
->
extsrc
;
}
}
}
}
/**
* @inheritDoc
*/
public
function
wtPostprocess
(
ParsoidExtensionAPI
$extApi
,
Node
$node
,
array
$options
):
void
{
// Pass an object since we want the data to be carried around across
// nodes in the DOM. Passing an array won't work since visitDOM doesn't
// use a reference on its end. Maybe we could fix that separately.
DOMUtils
::
visitDOM
(
$node
,
[
$this
,
'staticTagPostProcessor'
],
(
object
)[
'buf'
=>
''
]
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 19 2026, 20:20 (7 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ce/b5/f2f5dbc0f76f9011064c5851575b
Default Alt Text
ParserHookProcessor.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment