Fix encoding of non-breaking spaces if found in ref names

* This partly replicates the fixes in I9435a2d and Ia01f2fd. More
  to be done in later patches.
* Updated html/parsoid test output (which matches the change in the
  html/php section).

Depends-On: I401656265253a429691cc76adc5db5b129cff2cc
Change-Id: I7249bd03a7942ff7725a20178a051300b777e3a8
This commit is contained in:
Subramanya Sastry 2023-12-07 15:54:07 -06:00 committed by Thiemo Kreuz (WMDE)
parent d07d6affd9
commit 0754bc9ffd

View file

@ -88,7 +88,7 @@ class ReferencesData {
*/
private function normalizeKey( string $key ): string {
$ret = Sanitizer::escapeIdForAttribute( $key );
$ret = preg_replace( '/__+/', '_', $ret );
$ret = preg_replace( '/[_\s]+/u', '_', $ret );
// FIXME: The extension to the legacy parser does the following too,
// but Parsoid hasn't ported it yet and needs investigation of
// whether it's still relevant in the Parsoid context.