Marcoil has uploaded a new change for review. https://gerrit.wikimedia.org/r/169732
Change subject: Bug 67657: Add normalized param names to templates ...................................................................... Bug 67657: Add normalized param names to templates If the original parameter had wikitext making it different from the normalized name, a new attribute paramWt will contain the parameter wikitext. Change-Id: I466243013955df1990cdf93469bef8be9c80f96e --- M lib/ext.core.TemplateHandler.js 1 file changed, 8 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/32/169732/1 diff --git a/lib/ext.core.TemplateHandler.js b/lib/ext.core.TemplateHandler.js index 775d455..c81ab20 100644 --- a/lib/ext.core.TemplateHandler.js +++ b/lib/ext.core.TemplateHandler.js @@ -977,7 +977,7 @@ // Ignore params[0] -- that is the template name for (var i = 1, n = params.length; i < n; i++) { var srcOffsets = params[i].srcOffsets; - var kSrc, k, vSrc, v, paramInfo; + var kSrc, k, kWt, vSrc, v, paramInfo; if (srcOffsets) { kSrc = src.substring(srcOffsets[0], srcOffsets[1]); vSrc = src.substring(srcOffsets[2], srcOffsets[3]); @@ -986,7 +986,8 @@ vSrc = params[i].v; } - k = kSrc.trim(); + kWt = kSrc.trim(); + k = Util.tokensToString(params[i].k).trim(); v = vSrc; // Number positional parameters @@ -1040,6 +1041,11 @@ } dict[k] = { wt: v }; + // Only add the original parameter wikitext if named and different from + // the actual parameter. + if (!isPositional && kWt !== k) { + dict[k].paramWt = kWt; + } } var tplTgtSrcOffsets = params[0].srcOffsets; -- To view, visit https://gerrit.wikimedia.org/r/169732 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I466243013955df1990cdf93469bef8be9c80f96e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Marcoil <marc...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits