MWCategoryMetaItem: Allow trailing whitespace (e.g. \n) in category names

Encountered on a page with [[d:Template:Translation_categories]].

Change-Id: Ib2df3518e3047d32626a156c32d5ef9e37ea9b3a
This commit is contained in:
James D. Forrester 2020-10-06 12:17:30 -07:00
parent 7f5da34de8
commit 8539f75b54

View file

@ -36,7 +36,7 @@ ve.dm.MWCategoryMetaItem.static.toDataElement = function ( domElements ) {
var href = domElements[ 0 ].getAttribute( 'href' ),
data = mw.libs.ve.parseParsoidResourceName( href ),
rawTitleAndFragment = data.rawTitle.match( /^(.*?)(?:#(.*))?$/ ),
titleAndFragment = data.title.match( /^(.*?)(?:#(.*))?$/ );
titleAndFragment = data.title.match( /^(.*?)(?:#(.*))?\s*$/ );
return {
type: this.name,
attributes: {