MediaWiki  master
RemexMungerData.php
Go to the documentation of this file.
1 <?php
2 
3 namespace MediaWiki\Tidy;
4 
17 
25 
34  public $wrapBaseNode;
35 
46 
52  public $isPWrapper = false;
53 
61  public $isSplittable = false;
62 
67  public $needsPWrapping = false;
68 
73  public $nonblankNodeCount = 0;
74 
75  public function __set( $name, $value ) {
76  // @phan-suppress-previous-line PhanPluginNeverReturnMethod
77  throw new \Exception( "Cannot set property \"$name\"" );
78  }
79 
86  public function dump() {
87  $parts = [];
88 
89  if ( $this->childPElement ) {
90  $parts[] = 'childPElement=' . $this->childPElement->getDebugTag();
91  }
92  if ( $this->ancestorPNode ) {
93  $parts[] = "ancestorPNode=<{$this->ancestorPNode->name}>";
94  }
95  if ( $this->wrapBaseNode ) {
96  $parts[] = "wrapBaseNode=<{$this->wrapBaseNode->name}>";
97  }
98  if ( $this->currentCloneElement ) {
99  $parts[] = "currentCloneElement=" . $this->currentCloneElement->getDebugTag();
100  }
101  if ( $this->isPWrapper ) {
102  $parts[] = 'isPWrapper';
103  }
104  if ( $this->isSplittable ) {
105  $parts[] = 'isSplittable';
106  }
107  if ( $this->needsPWrapping ) {
108  $parts[] = 'needsPWrapping';
109  }
110  if ( $this->nonblankNodeCount ) {
111  $parts[] = "nonblankNodeCount={$this->nonblankNodeCount}";
112  }
113  $s = "RemexMungerData {\n";
114  foreach ( $parts as $part ) {
115  $s .= " $part\n";
116  }
117  $s .= "}\n";
118  return $s;
119  }
120 }
bool $isSplittable
Is the node splittable, i.e.
$nonblankNodeCount
The number of child nodes, not counting whitespace-only text nodes or comments.
bool $isPWrapper
Is the node a p-wrapper, with name mw:p-wrap?
Wikimedia RemexHtml Serializer SerializerNode null $ancestorPNode
This tracks the mw:p-wrap node in the Serializer stack which is an ancestor of this node.
Wikimedia RemexHtml TreeBuilder Element null $currentCloneElement
Stack splitting (essentially our idea of AFE reconstruction) can clone formatting elements which are ...
Wikimedia RemexHtml TreeBuilder Element null $childPElement
The Element for the mw:p-wrap which is a child of the current node.
$needsPWrapping
This is true if the node is a body or blockquote, which activates p-wrapping of child nodes.
Wikimedia RemexHtml Serializer SerializerNode null $wrapBaseNode
The wrap base node is the body or blockquote node which is the parent of active p-wrappers.
dump()
Get a text representation of the current state of the serializer, for debugging.