r93809 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93808‎ | r93809 | r93810 >
Date:08:05, 3 August 2011
Author:brion
Status:deferred
Tags:
Comment:
ParserPlayground: fix for li output; initial list item detection; needs more clarity.
Modified paths:
  • /trunk/extensions/ParserPlayground/modules/ext.parserPlayground.renderer.js (modified) (history)
  • /trunk/extensions/ParserPlayground/modules/pegParser.pegjs.txt (modified) (history)
  • /trunk/extensions/ParserPlayground/tests/parserTests.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ParserPlayground/tests/parserTests.js
@@ -128,6 +128,10 @@
129129 if (err) {
130130 console.log('RENDER FAIL', err);
131131 } else {
 132+ console.log('EXPECTED:');
 133+ console.log(item.result + "\n");
 134+
 135+ console.log('RENDERED:');
132136 console.log(node.innerHTML + "\n");
133137 }
134138 });
Index: trunk/extensions/ParserPlayground/modules/ext.parserPlayground.renderer.js
@@ -129,10 +129,10 @@
130130 $.map(tree.attrs, function(val, key) {
131131 $span.attr(key, val); // @fixme safety!
132132 });
133 - if ('content' in tree) {
134 - subParseArray(tree.content, $span);
135 - }
136133 }
 134+ if ('content' in tree) {
 135+ subParseArray(tree.content, $span);
 136+ }
137137 node = $span[0];
138138 break;
139139 case 'hashlink':
Index: trunk/extensions/ParserPlayground/modules/pegParser.pegjs.txt
@@ -15,6 +15,7 @@
1616 block
1717 = br
1818 / h
 19+ / li
1920 / para
2021
2122 h = h1 / h2 / h3 / h4 / h5 / h6
@@ -345,3 +346,21 @@
346347 = t:[0-9A-Za-z]+ { return {text: t.join('') } }
347348 / "'" t:[^'>]+ "'" { return { quote: "'", text: t.join('') } }
348349 / '"' t:[^">]+ '"' { return { quote: '"', text: t.join('') } }
 350+
 351+
 352+li = bullets:list_char+
 353+ c:(inline / anything)
 354+ newline
 355+{
 356+ return {
 357+ type: 'li',
 358+ listStyle: bullets,
 359+ content: c
 360+ };
 361+}
 362+
 363+list_char =
 364+ '*' /
 365+ '#' /
 366+ ':' /
 367+ ';'

Status & tagging log