23 public function __construct( array $options, callable $shouldModifyCallback, callable $modifyCallback ) {
24 parent::__construct( $options );
25 $this->shouldModifyCallback = $shouldModifyCallback;
26 $this->modifyCallback = $modifyCallback;
28 '@phan-var HtmlFormatter $this';
29 $this->textEscapes[
"\u{0338}"] =
'̸';
38 public function element( SerializerNode $parent, SerializerNode $node, $contents ) {
39 if ( ( $this->shouldModifyCallback )( $node ) ) {
41 $node->attrs = clone $node->attrs;
42 $newNode = ( $this->modifyCallback )( $node );
43 Assert::parameterType( [ SerializerNode::class,
'string' ], $newNode,
'return value' );
44 if ( is_string( $newNode ) ) {
48 return parent::element( $parent, $newNode, $contents );
50 return parent::element( $parent, $node, $contents );