Arlolra has uploaded a new change for review.
https://gerrit.wikimedia.org/r/216015
Change subject: WIP: "!!" should only break "!"-based <th> on the line they
start
......................................................................
WIP: "!!" should only break "!"-based <th> on the line they start
Change-Id: I28e42342fb0aeb89316574780df0cba7bdaf721f
---
M lib/mediawiki.tokenizer.utils.js
M lib/pegTokenizer.pegjs.txt
M tests/parserTests.txt
3 files changed, 51 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid
refs/changes/15/216015/1
diff --git a/lib/mediawiki.tokenizer.utils.js b/lib/mediawiki.tokenizer.utils.js
index ffaac1d..39adaaf 100644
--- a/lib/mediawiki.tokenizer.utils.js
+++ b/lib/mediawiki.tokenizer.utils.js
@@ -218,6 +218,11 @@
return stops.onStack('table') &&
/\r\n?\s*[!|]/.test(input.substr(pos));
case "\n":
+ // See the comments at the table_heading_tag
rule.
+ if (stops.onStack('th')) {
+ stops.pop('th');
+ }
+
// The code below is just a manual / efficient
// version of this check.
//
diff --git a/lib/pegTokenizer.pegjs.txt b/lib/pegTokenizer.pegjs.txt
index 1f09b06..796f2f6 100644
--- a/lib/pegTokenizer.pegjs.txt
+++ b/lib/pegTokenizer.pegjs.txt
@@ -1776,7 +1776,12 @@
}
table_heading_tag
- = & { return stops.push('th', true); }
+ = & {
+ // This SyntaxStop is only true until we hit the end of the line.
+ // As a not-entirely-perfect workaround, we pop it if we hit an inline
+ // break at a newline character.
+ return stops.push('th', true);
+ }
arg:row_syntax_table_args?
tagEndPos:({return peg$currPos;})
c:nested_block_in_table* {
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 1011ba8..0b328ae 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -5681,6 +5681,46 @@
!! end
!! test
+Accept "!!" in table headings after newline
+!! wikitext
+{|
+!a
+b!!c
+|}
+!! html
+<table>
+<tr>
+<th>a
+<p>b!!c
+</p>
+</th></tr></table>
+
+!! end
+
+!! test
+Accept "!!" in table data of mixed wikitext / html syntax
+!! wikitext
+{|
+!a
+<tr><td>b!!c</td></tr>
+|}
+!! html+tidy
+<table>
+<tr>
+<th>a</th>
+</tr>
+<tr>
+<td>b!!c</td>
+</tr>
+</table>
+!! html/parsoid
+<table>
+<tbody><tr><th>a</th></tr>
+<tr data-parsoid='{"stx":"html"}'><td
data-parsoid='{"stx":"html"}'>b!!c</td></tr>
+</tbody></table>
+!! end
+
+!! test
Accept empty attributes in td/th cells (td/th cells starting with leading ||)
!! wikitext
{|
--
To view, visit https://gerrit.wikimedia.org/r/216015
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I28e42342fb0aeb89316574780df0cba7bdaf721f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits