Werdna has submitted this change and it was merged.
Change subject: renderer.article: Bold the title no matter what the trailing
characters
......................................................................
renderer.article: Bold the title no matter what the trailing characters
Bug: T69229
Change-Id: I833c0dcae98010bc74b6b58ae8035aaac4e6465b
---
M resources/ext.popups.renderer.article.js
M tests/qunit/ext.popups.renderer.article.test.js
2 files changed, 14 insertions(+), 2 deletions(-)
Approvals:
Werdna: Looks good to me, approved
diff --git a/resources/ext.popups.renderer.article.js
b/resources/ext.popups.renderer.article.js
index 895abea..7d100ba 100644
--- a/resources/ext.popups.renderer.article.js
+++ b/resources/ext.popups.renderer.article.js
@@ -155,7 +155,7 @@
title = title.replace( /([.?*+^$[\]\\(){}|-])/g, '\\$1' ); //
Escape RegExp elements
var elements = [],
- regExp = new RegExp( '(^|\\s)(' + title + ')(\\s|$)',
'ig' ),
+ regExp = new RegExp( '(^|\\s)(' + title + ')(|$)', 'ig'
),
boldIdentifier = '<bi-' + Math.random() + '>',
snip = '<snip-' + Math.random() + '>';
diff --git a/tests/qunit/ext.popups.renderer.article.test.js
b/tests/qunit/ext.popups.renderer.article.test.js
index 6bca34e..81e58bd 100644
--- a/tests/qunit/ext.popups.renderer.article.test.js
+++ b/tests/qunit/ext.popups.renderer.article.test.js
@@ -2,7 +2,7 @@
QUnit.module( 'ext.popups' );
QUnit.test( 'render.article.getProcessedElements', function ( assert ) {
- QUnit.expect( 9 );
+ QUnit.expect( 11 );
function test ( extract, title, expected, msg ) {
var $div = $( '<div>' ).append(
@@ -30,6 +30,12 @@
);
test(
+ 'Person, (was born in Location) is good', 'Person',
+ '<b>Person</b>, is good',
+ 'Comma after title'
+ );
+
+ test(
'Person (was born in Location (at Time)) is good',
'Person',
'<b>Person</b> is good',
'Extract with nested parentheses'
@@ -42,6 +48,12 @@
);
test(
+ 'I like trains', 'Train',
+ 'I like <b>train</b>s',
+ 'Make the simple plural bold'
+ );
+
+ test(
'Brackets ) are funny ( when not used properly',
'Brackets',
'<b>Brackets</b> ) are funny ( when not used properly',
'Extract with unbalanced parentheses'
--
To view, visit https://gerrit.wikimedia.org/r/182446
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I833c0dcae98010bc74b6b58ae8035aaac4e6465b
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/Popups
Gerrit-Branch: master
Gerrit-Owner: Prtksxna <[email protected]>
Gerrit-Reviewer: AndyRussG <[email protected]>
Gerrit-Reviewer: GreenReaper <[email protected]>
Gerrit-Reviewer: Prtksxna <[email protected]>
Gerrit-Reviewer: Werdna <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits