mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-03 11:06:17 +00:00
Merge "Revert "Normalize ref html before comparison""
This commit is contained in:
commit
ca4746ae74
|
@ -10,7 +10,6 @@ use Cite\Cite;
|
|||
use Cite\MarkSymbolRenderer;
|
||||
use Closure;
|
||||
use MediaWiki\Config\Config;
|
||||
use MediaWiki\HtmlHelper;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use stdClass;
|
||||
use Wikimedia\Message\MessageValue;
|
||||
|
@ -28,7 +27,6 @@ use Wikimedia\Parsoid\NodeData\DataMw;
|
|||
use Wikimedia\Parsoid\NodeData\DataMwError;
|
||||
use Wikimedia\Parsoid\NodeData\DataParsoid;
|
||||
use Wikimedia\Parsoid\Utils\DOMCompat;
|
||||
use Wikimedia\RemexHtml\Serializer\SerializerNode;
|
||||
|
||||
/**
|
||||
* @license GPL-2.0-or-later
|
||||
|
@ -225,7 +223,7 @@ class References extends ExtensionTagHandler {
|
|||
$ref->cachedHtml = $extApi->domToHtml( $refContent, true, false );
|
||||
}
|
||||
$html = $extApi->domToHtml( $c, true, false );
|
||||
$contentDiffers = ( $this->normalizeRef( $html ) !== $this->normalizeRef( $ref->cachedHtml ) );
|
||||
$contentDiffers = ( $html !== $ref->cachedHtml );
|
||||
}
|
||||
} else {
|
||||
if ( $refsData->inReferencesContent() ) {
|
||||
|
@ -877,17 +875,4 @@ class References extends ExtensionTagHandler {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function normalizeRef( string $s ): string {
|
||||
return HtmlHelper::modifyElements( $s,
|
||||
static function ( SerializerNode $node ): bool {
|
||||
return isset( $node->attrs['data-parsoid'] ) || isset( $node->attrs['about'] );
|
||||
},
|
||||
static function ( SerializerNode $node ): SerializerNode {
|
||||
unset( $node->attrs['data-parsoid'] );
|
||||
unset( $node->attrs['about'] );
|
||||
return $node;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue