MediaWiki master
RemexMungerData.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Tidy;
4
5use InvalidArgumentException;
6use Wikimedia\RemexHtml\Serializer\SerializerNode;
7use Wikimedia\RemexHtml\TreeBuilder\Element;
8
21
29
39
50
56 public $isPWrapper = false;
57
65 public $isSplittable = false;
66
71 public $needsPWrapping = false;
72
78
79 public function __set( $name, $value ) {
80 // @phan-suppress-previous-line PhanPluginNeverReturnMethod
81 throw new InvalidArgumentException( "Cannot set property \"$name\"" );
82 }
83
90 public function dump() {
91 $parts = [];
92
93 if ( $this->childPElement ) {
94 $parts[] = 'childPElement=' . $this->childPElement->getDebugTag();
95 }
96 if ( $this->ancestorPNode ) {
97 $parts[] = "ancestorPNode=<{$this->ancestorPNode->name}>";
98 }
99 if ( $this->wrapBaseNode ) {
100 $parts[] = "wrapBaseNode=<{$this->wrapBaseNode->name}>";
101 }
102 if ( $this->currentCloneElement ) {
103 $parts[] = "currentCloneElement=" . $this->currentCloneElement->getDebugTag();
104 }
105 if ( $this->isPWrapper ) {
106 $parts[] = 'isPWrapper';
107 }
108 if ( $this->isSplittable ) {
109 $parts[] = 'isSplittable';
110 }
111 if ( $this->needsPWrapping ) {
112 $parts[] = 'needsPWrapping';
113 }
114 if ( $this->nonblankNodeCount ) {
115 $parts[] = "nonblankNodeCount={$this->nonblankNodeCount}";
116 }
117 $s = "RemexMungerData {\n";
118 foreach ( $parts as $part ) {
119 $s .= " $part\n";
120 }
121 $s .= "}\n";
122 return $s;
123 }
124}
bool $isSplittable
Is the node splittable, i.e.
$nonblankNodeCount
The number of child nodes, not counting whitespace-only text nodes or comments.
SerializerNode null $wrapBaseNode
The wrap base node is the body or blockquote node which is the parent of active p-wrappers.
bool $isPWrapper
Is the node a p-wrapper, with name mw:p-wrap?
Element null $currentCloneElement
Stack splitting (essentially our idea of AFE reconstruction) can clone formatting elements which are ...
$needsPWrapping
This is true if the node is a body or blockquote, which activates p-wrapping of child nodes.
dump()
Get a text representation of the current state of the serializer, for debugging.
Element null $childPElement
The Element for the mw:p-wrap which is a child of the current node.
SerializerNode null $ancestorPNode
This tracks the mw:p-wrap node in the Serializer stack which is an ancestor of this node.