Subramanya Sastry has uploaded a new change for review. https://gerrit.wikimedia.org/r/316213
Change subject: T147742: Trim template target after stripping comments ...................................................................... T147742: Trim template target after stripping comments Change-Id: If69246776b165f833ae58fdaf72eaced0fd2f255 --- M lib/wt2html/tt/TemplateHandler.js M tests/parserTests.txt 2 files changed, 11 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/13/316213/1 diff --git a/lib/wt2html/tt/TemplateHandler.js b/lib/wt2html/tt/TemplateHandler.js index b26cea1..adac655 100644 --- a/lib/wt2html/tt/TemplateHandler.js +++ b/lib/wt2html/tt/TemplateHandler.js @@ -421,8 +421,11 @@ if (tgtInfo.isStr && !tgtInfo.isSimpleTgt) { // resolvabilityInfo found a new target based on the target tokens. This // happens when the target contains special characters, specially quotes. - // For an example look at T96090. - target = tgtInfo.newTarget; + // For an example, look at T96090. + + // Without a trim(), we get bug T147742 because + // the prefix === target check below fails! + target = tgtInfo.newTarget.trim(); pieces = target.split(':'); prefix = pieces[0].trim(); lowerPrefix = prefix.toLowerCase(); diff --git a/tests/parserTests.txt b/tests/parserTests.txt index 536525a..750e590 100644 --- a/tests/parserTests.txt +++ b/tests/parserTests.txt @@ -2716,6 +2716,10 @@ <!-- should be ignored --> |foo}} +{{echo +<!-- should be ignored and spaces on next line should not trip us up (T147742) --> + |foo}} + {{echo<!-- should be ignored --> |foo}} @@ -2725,6 +2729,8 @@ !!html/parsoid <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n<!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p> +<p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n<!-- should be ignored and spaces on next line should not trip us up (T147742) -->\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p> + <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo<!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p> <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo<!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p> -- To view, visit https://gerrit.wikimedia.org/r/316213 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If69246776b165f833ae58fdaf72eaced0fd2f255 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Subramanya Sastry <ssas...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits