72 $this->parts = [
new $class ];
74 foreach ( $data as $name => $value ) {
75 $this->$name = $value;
80 return $this->parts[count( $this->parts ) - 1]->out;
85 $this->parts[] =
new $class( $s );
92 return $this->parts[count( $this->parts ) - 1];
99 $partCount = count( $this->parts );
100 $findPipe = $this->open !=
"\n" && $this->open !=
'[';
102 'findPipe' => $findPipe,
103 'findEquals' => $findPipe && $partCount > 1 && !isset( $this->parts[$partCount - 1]->eqpos ),
104 'inHeading' => $this->open ==
"\n",
115 if ( $this->open ==
"\n" ) {
116 $accum = array_merge( [ $this->savedPrefix ], $this->parts[0]->out );
118 if ( $openingCount ===
false ) {
121 $s = substr( $this->open, 0, -1 );
123 substr( $this->open, -1 ),
124 $openingCount - strlen( $s )
126 $accum = [ $this->savedPrefix . $s ];
129 foreach ( $this->parts as $part ) {
132 } elseif ( is_string( $accum[$lastIndex] ) ) {
133 $accum[$lastIndex] .=
'|';
135 $accum[++$lastIndex] =
'|';
138 foreach ( $part->out as $node ) {
139 if ( is_string( $node ) && is_string( $accum[$lastIndex] ) ) {
140 $accum[$lastIndex] .= $node;
142 $accum[++$lastIndex] = $node;
string $savedPrefix
Saved prefix that may affect later processing, e.g.
int $startPos
Start offset of this element in the source wikitext.
int $count
Number of opening characters found (number of "=" for heading)
bool $lineStart
True if the open char appeared at the start of the input line.
PPDPart_Hash[] $parts
Array of PPDPart objects describing pipe-separated parts.
breakSyntax( $openingCount=false)
Get the accumulator that would result if the close is not found.
string $close
Matching closing character.
string $open
Opening character (\n for heading)