Index: trunk/extensions/VisualEditor/tests/parser/parserTests.js |
— | — | @@ -47,13 +47,11 @@ |
48 | 48 | |
49 | 49 | // WikiDom and serializers |
50 | 50 | _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')); |
54 | 52 | _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')); |
58 | 56 | |
59 | 57 | // Preload the grammar file... |
60 | 58 | PegParser.src = fs.readFileSync(path.join(basePath, 'parser', 'pegParser.pegjs.txt'), 'utf8'); |
— | — | @@ -127,11 +125,9 @@ |
128 | 126 | } |
129 | 127 | console.log(item.title); |
130 | 128 | console.log("INPUT:"); |
131 | | - console.log(item.input); |
| 129 | + console.log(item.input + "\n"); |
132 | 130 | |
133 | 131 | parser.parseToTree(item.input + "\n", function(tree, err) { |
134 | | - console.log('INPUT:'); |
135 | | - console.log(item.input + "\n"); |
136 | 132 | if (err) { |
137 | 133 | console.log('PARSE FAIL', err); |
138 | 134 | } else { |
— | — | @@ -141,10 +137,9 @@ |
142 | 138 | 'references': MWReferencesTagHook |
143 | 139 | } |
144 | 140 | }); |
145 | | - var renderer = new es.Document.HtmlSerializer(environment); |
146 | 141 | // 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); |
149 | 144 | if (err) { |
150 | 145 | console.log('RENDER FAIL', err); |
151 | 146 | } else { |
Index: trunk/extensions/VisualEditor/modules/parser/pegParser.pegjs.txt |
— | — | @@ -235,8 +235,9 @@ |
236 | 236 | br |
237 | 237 | = newline { return {type: 'br'} } |
238 | 238 | |
| 239 | +// TODO: convert inline content to annotations! |
239 | 240 | para |
240 | | - = c:inlineline newline { return {type: 'paragraph', content: c } } / |
| 241 | + = c:inlineline newline { return {type: 'paragraph', content: c[0] } } / |
241 | 242 | c:anyline |
242 | 243 | |
243 | 244 | inline |