jenkins-bot has submitted this change and it was merged.
Change subject: Pop tableCellArg before parsing template args
......................................................................
Pop tableCellArg before parsing template args
* Fixes the regression on enwiki/NCIS_(TV_series)?oldid=679456674
Change-Id: Ie218315576a944236884a4964cd75d16b93d0f53
---
M lib/mediawiki.tokenizer.utils.js
M lib/pegTokenizer.pegjs.txt
M tests/parserTests.txt
3 files changed, 24 insertions(+), 5 deletions(-)
Approvals:
Subramanya Sastry: Looks good to me, approved
jenkins-bot: Verified
diff --git a/lib/mediawiki.tokenizer.utils.js b/lib/mediawiki.tokenizer.utils.js
index 5026e16..7ab4e9c 100644
--- a/lib/mediawiki.tokenizer.utils.js
+++ b/lib/mediawiki.tokenizer.utils.js
@@ -190,7 +190,6 @@
case '|':
return stops.onStack('pipe') ||
counters.linkdesc ||
- stops.onStack('tableCellArg') ||
(stops.onStack('table') && (
pos < input.length - 1 &&
/[}|]/.test(input[pos + 1])));
@@ -201,7 +200,7 @@
case '{':
// {{!}} pipe templates..
return (
- ((stops.onStack('pipe') ||
stops.onStack('tableCellArg')) &&
+ (stops.onStack('pipe') &&
!counters.template &&
input.substr(pos, 5) ===
'{{!}}') ||
(stops.onStack('table') &&
diff --git a/lib/pegTokenizer.pegjs.txt b/lib/pegTokenizer.pegjs.txt
index c32ae2a..06395f4 100644
--- a/lib/pegTokenizer.pegjs.txt
+++ b/lib/pegTokenizer.pegjs.txt
@@ -742,12 +742,14 @@
stops.push('table', false);
stops.push('extlink', false);
stops.push('pipe', true);
+ stops.push('tableCellArg', false);
return stops.inc('template');
}
il:(nested_block / newlineToken)+ {
stops.pop('table');
stops.pop('extlink');
stops.pop('pipe');
+ stops.pop('tableCellArg');
stops.dec('template');
// il is guaranteed to be an array -- so, tu.flattenIfArray will
// always return an array
@@ -757,7 +759,12 @@
}
return r;
}
- / & { stops.pop('table'); stops.pop('extlink'); stops.pop('pipe'); return
stops.dec('template'); }
+ / & { stops.pop('table');
+ stops.pop('extlink');
+ stops.pop('pipe');
+ stops.pop('tableCellArg');
+ return stops.dec('template');
+ }
wikilink_content
@@ -1722,12 +1729,13 @@
* match if followed by double pipe (row-based syntax).
*/
row_syntax_table_args
- = & { return stops.push('tableCellArg', true); }
+ = & { stops.push('pipe', true); stops.push('tableCellArg', true); return
true; }
as:table_attributes s:space* p:pipe !pipe {
stops.pop('tableCellArg');
+ stops.pop('pipe');
return [as, s, p];
}
- / & { return stops.pop('tableCellArg'); }
+ / & { stops.pop('tableCellArg'); stops.pop('pipe'); return false; }
/*******************************************************************
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 1f38cc5..c2ee57c 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -10385,6 +10385,18 @@
!! end
!! test
+Don't abort table cell attribute parsing if wikilink is found in template arg
+!! wikitext
+{|
+| Test {{#tag:ref|One two "[[three]]" four}}
+|}
+!! html/parsoid
+<table>
+<tbody><tr><td> Test <ref about="#mwt1" typeof="mw:Transclusion"
data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'
data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"#tag"},"params":{"1":{"wt":"One
two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink"
href="./Three" title="Three">three</a>" four</ref></td></tr>
+</tbody></table>
+!! end
+
+!! test
Magic variable as template parameter
!! wikitext
{{paramtest|param={{SITENAME}}}}
--
To view, visit https://gerrit.wikimedia.org/r/237681
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie218315576a944236884a4964cd75d16b93d0f53
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits