From c3bc1f00b0c9e250e709c60e13ca7b99bb53b299 Mon Sep 17 00:00:00 2001 From: sbailey Date: Fri, 8 Jan 2021 11:07:49 -0800 Subject: [PATCH] Contract multiple underbars in a row in refnames to a single underbar * Inlcudes test coverage for refnames with single and more than one underbar in a row which are maintained as separate keys but serialized without the multiple underbars Bug: T267974 Change-Id: I9c21a6ff761f4b9a22b1185280b5676e2c160208 --- src/Parsoid/ReferencesData.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Parsoid/ReferencesData.php b/src/Parsoid/ReferencesData.php index 2932d3a20..680da1aac 100644 --- a/src/Parsoid/ReferencesData.php +++ b/src/Parsoid/ReferencesData.php @@ -115,6 +115,7 @@ class ReferencesData { // FIXME: normalizeKey in core performs a few more operations on $refName, // which will be addressed in a follow up $refNameSanitized = Sanitizer::escapeIdForAttribute( $refName ); + $refNameSanitized = preg_replace( '/__+/', '_', $refNameSanitized ); $refIdBase = 'cite_ref-' . ( $hasRefName ? $refNameSanitized . '_' . $refKey : $refKey ); $noteId = 'cite_note-' . ( $hasRefName ? $refNameSanitized . '-' . $refKey : $refKey );