r101969 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101968‎ | r101969 | r101970 >
Date:07:45, 4 November 2011
Author:gwicke
Status:deferred
Tags:
Comment:
Update parserTests to latest serializers
Modified paths:
  • /trunk/extensions/VisualEditor/modules/parser/pegParser.pegjs.txt (modified) (history)
  • /trunk/extensions/VisualEditor/tests/parser/parserTests.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/tests/parser/parserTests.js
@@ -47,13 +47,11 @@
4848
4949 // WikiDom and serializers
5050 _require(pj('es', 'es.js'));
51 -_require(pj('es', 'bases', 'es.EventEmitter.js'));
52 -_require(pj('es', 'bases', 'es.Document.js'));
53 -_require(pj('es', 'bases', 'es.Document.Serializer.js'));
 51+_require(pj('es', 'es.Html.js'));
5452 _require(pj('es', 'serializers', 'es.AnnotationSerializer.js'));
55 -_require(pj('es', 'serializers', 'es.Document.HtmlSerializer.js'));
56 -_require(pj('es', 'serializers', 'es.Document.WikitextSerializer.js'));
57 -_require(pj('es', 'serializers', 'es.Document.JsonSerializer.js'));
 53+_require(pj('es', 'serializers', 'es.HtmlSerializer.js'));
 54+_require(pj('es', 'serializers', 'es.WikitextSerializer.js'));
 55+_require(pj('es', 'serializers', 'es.JsonSerializer.js'));
5856
5957 // Preload the grammar file...
6058 PegParser.src = fs.readFileSync(path.join(basePath, 'parser', 'pegParser.pegjs.txt'), 'utf8');
@@ -127,11 +125,9 @@
128126 }
129127 console.log(item.title);
130128 console.log("INPUT:");
131 - console.log(item.input);
 129+ console.log(item.input + "\n");
132130
133131 parser.parseToTree(item.input + "\n", function(tree, err) {
134 - console.log('INPUT:');
135 - console.log(item.input + "\n");
136132 if (err) {
137133 console.log('PARSE FAIL', err);
138134 } else {
@@ -141,10 +137,9 @@
142138 'references': MWReferencesTagHook
143139 }
144140 });
145 - var renderer = new es.Document.HtmlSerializer(environment);
146141 // XXX: hack
147 - tree.blocks = tree.content;
148 - var res = renderer.serializeDocument(tree, false);
 142+ tree.children = tree.content;
 143+ var res = es.HtmlSerializer.stringify(tree,environment);
149144 if (err) {
150145 console.log('RENDER FAIL', err);
151146 } else {
Index: trunk/extensions/VisualEditor/modules/parser/pegParser.pegjs.txt
@@ -235,8 +235,9 @@
236236 br
237237 = newline { return {type: 'br'} }
238238
 239+// TODO: convert inline content to annotations!
239240 para
240 - = c:inlineline newline { return {type: 'paragraph', content: c } } /
 241+ = c:inlineline newline { return {type: 'paragraph', content: c[0] } } /
241242 c:anyline
242243
243244 inline

Status & tagging log