emitChunk( $this->getListBullets( $state, $node ), $node );
}
$liHandler = static function ( $state, $text, $opts ) use ( $node ) {
return $state->serializer->wteHandlers->liHandler( $node, $state, $text, $opts );
};
$state->singleLineContext->enforce();
$state->serializeChildren( $node, $liHandler );
// Recover trailing whitespace (only on unmodified innermost
nodes);
// Consider "*** foo ". Since WS is only trimmed on the innermost node,
// it makes sense to recover this only for the innermost node.
// [ Given current DSR offsets, without this check, we'll recover one space for
// every nested node which makes for lotsa dirty diffs. ]
$lastChild = DiffDOMUtils::lastNonSepChild( $node );
if ( $lastChild && !DOMUtils::isList( $lastChild ) &&
!DiffUtils::hasDiffMarkers( $lastChild ) &&
!( $lastChild instanceof Element && $lastChild->hasAttribute( 'data-mw-selser-wrapper' ) )
) {
$trailingSpace = $state->recoverTrimmedWhitespace( $node, false );
$state->appendSep( $trailingSpace ?? '' );
}
$state->singleLineContext->pop();
return $node->nextSibling;
}
/** @inheritDoc */
public function before( Element $node, Node $otherNode, SerializerState $state ): array {
if ( ( $otherNode === $node->parentNode
&& in_array( DOMCompat::nodeName( $otherNode ), [ 'ul', 'ol' ], true ) )
|| ( $otherNode instanceof Element
&& ( DOMDataUtils::getDataParsoid( $otherNode )->stx ?? null ) === 'html' )
) {
return [];
} else {
return [ 'min' => 1, 'max' => 2 ];
}
}
/** @inheritDoc */
public function after( Element $node, Node $otherNode, SerializerState $state ): array {
return $this->wtListEOL( $node, $otherNode );
}
/** @inheritDoc */
public function firstChild( Node $node, Node $otherNode, SerializerState $state ): array {
if ( !DOMUtils::isList( $otherNode ) ) {
return [ 'min' => 0, 'max' => 0 ];
} else {
return [];
}
}
}