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
73 public $needsPWrapping = false;
74
82
83 public function __set( $name, $value ) {
84 // @phan-suppress-previous-line PhanPluginNeverReturnMethod
85 throw new InvalidArgumentException( "Cannot set property \"$name\"" );
86 }
87
94 public function dump() {
95 $parts = [];
96
97 if ( $this->childPElement ) {
98 $parts[] = 'childPElement=' . $this->childPElement->getDebugTag();
99 }
100 if ( $this->ancestorPNode ) {
101 $parts[] = "ancestorPNode=<{$this->ancestorPNode->name}>";
102 }
103 if ( $this->wrapBaseNode ) {
104 $parts[] = "wrapBaseNode=<{$this->wrapBaseNode->name}>";
105 }
106 if ( $this->currentCloneElement ) {
107 $parts[] = "currentCloneElement=" . $this->currentCloneElement->getDebugTag();
108 }
109 if ( $this->isPWrapper ) {
110 $parts[] = 'isPWrapper';
111 }
112 if ( $this->isSplittable ) {
113 $parts[] = 'isSplittable';
114 }
115 if ( $this->needsPWrapping ) {
116 $parts[] = 'needsPWrapping';
117 }
118 if ( $this->nonblankNodeCount ) {
119 $parts[] = "nonblankNodeCount={$this->nonblankNodeCount}";
120 }
121 $s = "RemexMungerData {\n";
122 foreach ( $parts as $part ) {
123 $s .= " $part\n";
124 }
125 $s .= "}\n";
126 return $s;
127 }
128}
bool $isSplittable
Is the node splittable, i.e.
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 ...
int $nonblankNodeCount
The number of child nodes, not counting whitespace-only text nodes or comments.
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.
bool $needsPWrapping
This is true if the node is a body or blockquote, which activates p-wrapping of child nodes.
SerializerNode null $ancestorPNode
This tracks the mw:p-wrap node in the Serializer stack which is an ancestor of this node.