jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/394657 )
Change subject: Strip [[ ]] from parser tests options in the parser ...................................................................... Strip [[ ]] from parser tests options in the parser This is a (long-delayed) follow-up to https://gerrit.wikimedia.org/r/#/c/281037/25..29/bin/parserTests.js Bug: T140155 Change-Id: I6a14da69c4ac4496109f7f8b4b78df430ac9af7a --- M bin/parserTests.js M tests/parserTests.pegjs 2 files changed, 6 insertions(+), 5 deletions(-) Approvals: jenkins-bot: Verified Arlolra: Looks good to me, approved diff --git a/bin/parserTests.js b/bin/parserTests.js index 7d78803..cd03108 100755 --- a/bin/parserTests.js +++ b/bin/parserTests.js @@ -691,13 +691,11 @@ if (item.options.title !== undefined && !Array.isArray(item.options.title)) { - // Strip the [[]] markers. - var title = item.options.title.replace(/^\[\[|\]\]$/g, ''); // This sets the page name as well as the relative link prefix // for the rest of the parse. Do this redundantly with the above // so that we start from the defaultPageName when resolving // absolute subpages. - this.env.initializeForPageName(title); + this.env.initializeForPageName(item.options.title); } // Page language matches "wiki language" (which is set by // the item 'language' option). diff --git a/tests/parserTests.pegjs b/tests/parserTests.pegjs index c28fc9b..e8804a3 100644 --- a/tests/parserTests.pegjs +++ b/tests/parserTests.pegjs @@ -210,9 +210,12 @@ return v; } -link_target_value = v:("[[" (c:[^\]]* { return c.join(''); }) "]]") +link_target_value = "[[" v:[^\]]* "]]" { - return v.join(''); + // Perhaps we should canonicalize the title? + // Protect with JSON.stringify just in case the link target starts with + // double-quote or open-brace. + return JSON.stringify(v.join('')); } quoted_value = [\"] v:( [^\\\"] / ("\\" c:. { return "\\"+c; } ) )* [\"] -- To view, visit https://gerrit.wikimedia.org/r/394657 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6a14da69c4ac4496109f7f8b4b78df430ac9af7a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: C. Scott Ananian <canan...@wikimedia.org> Gerrit-Reviewer: Arlolra <abrea...@wikimedia.org> Gerrit-Reviewer: Sbailey <sbai...@wikimedia.org> Gerrit-Reviewer: Subramanya Sastry <ssas...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits