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
This commit is contained in:
sbailey 2021-01-08 11:07:49 -08:00 committed by jenkins-bot
parent 6ebe050750
commit c3bc1f00b0

View file

@ -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 );