Subramanya Sastry has uploaded a new change for review.
https://gerrit.wikimedia.org/r/78480
Change subject: (Bug 52473) Deal with trailing WS after indented tables
......................................................................
(Bug 52473) Deal with trailing WS after indented tables
* Trailing whitespace after table-closing tag ("|}") for an
indented table was breaking table-parse. This patch fixes that.
* Try this before/after:
echo ":{|\n|a\n|} " | node parse
* Added new parsoid-only parser test since it is hard to get
this working with both PHP and Parsoid without causing spurious
test failures.
Change-Id: I5ebafdaaa2304a1055136207a226f2127627193c
---
M js/lib/pegTokenizer.pegjs.txt
M js/tests/parserTests.txt
2 files changed, 15 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid
refs/changes/80/78480/1
diff --git a/js/lib/pegTokenizer.pegjs.txt b/js/lib/pegTokenizer.pegjs.txt
index 0f9f72d..e0f59d4 100644
--- a/js/lib/pegTokenizer.pegjs.txt
+++ b/js/lib/pegTokenizer.pegjs.txt
@@ -1881,17 +1881,14 @@
*/
hacky_dl_uses = bullets:":"+
c:table_lines
+ s:space* // Do we really need to RT this?
&eolf
{
- if ( c === '' ) {
- c = [];
- }
// Leave bullets as an array -- list handler expects this
var li = new TagTk( 'listItem', [], { tsr: [pos0, pos0 + bullets.length] }
);
li.bullets = bullets;
- return [ li, c ];
+ return flattenIfArray([li, c || [], s || []]);
}
-
dtdd
= bullets:(!(";" !list_char) lc:list_char { return lc; })*
diff --git a/js/tests/parserTests.txt b/js/tests/parserTests.txt
index 3b5ecaf..ed110c8 100644
--- a/js/tests/parserTests.txt
+++ b/js/tests/parserTests.txt
@@ -2224,6 +2224,19 @@
should be left alone
</p>
!! end
+
+# Bug 52473
+!! test
+Definition Lists: Hacky use to indent tables (WS-insensitive)
+!! options
+parsoid
+!! input
+: {|
+|a
+|}
+!! result
+<dl><dd> <table><tr><td>a</td></tr></table> </dd></dl>
+!! end
## The PHP parser treats : items (dd) without a corresponding ; item (dt)
## as an empty dt item. It also ignores all but the last ";" when followed
## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
--
To view, visit https://gerrit.wikimedia.org/r/78480
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5ebafdaaa2304a1055136207a226f2127627193c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits