Skip to content

Commit

Permalink
Strip everything before the first pf token
Browse files Browse the repository at this point in the history
In this isolate case,
{{safe<includeonly />subst:#if:{{{1}}}}}
only "subst:" is part of the same token as the prefix so
`normalizeTarget` doesn't take care of remove the "safesubst:"

The fix here is from noting that we wouldn't be at this place in the
code if the target didn't normalize a canonical function name, so the
contents before the prefix can be safely discarded.

This is another patch along the line of 5608e83 and bcd5572

Bug: T185643
Change-Id: I7002804fcf5305ffb6c88d93c201d9e972f9037f
  • Loading branch information
arlolra committed Jan 29, 2018
1 parent ebe48dc commit 91854ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/wt2html/tt/TemplateHandler.js
Expand Up @@ -473,7 +473,7 @@ TemplateHandler.prototype.resolveTemplateTarget = function(state, targetToks) {
if (canonicalFunctionName !== undefined) {
// Extract toks that make up pfArg
var pfArgToks;
var re = new RegExp(prefix, 'i');
var re = new RegExp('^(.*?)' + prefix, 'i');

// Because of the lenient stringifying above, we need to find the prefix
var i = targetToks.findIndex(function(t) {
Expand Down

0 comments on commit 91854ff

Please sign in to comment.