Index: trunk/extensions/VisualEditor/tests/parser/parserTests.js |
— | — | @@ -50,6 +50,7 @@ |
51 | 51 | _require(pj('es', 'bases', 'es.EventEmitter.js')); |
52 | 52 | _require(pj('es', 'bases', 'es.Document.js')); |
53 | 53 | _require(pj('es', 'bases', 'es.Document.Serializer.js')); |
| 54 | +_require(pj('es', 'serializers', 'es.AnnotationSerializer.js')); |
54 | 55 | _require(pj('es', 'serializers', 'es.Document.HtmlSerializer.js')); |
55 | 56 | _require(pj('es', 'serializers', 'es.Document.WikitextSerializer.js')); |
56 | 57 | _require(pj('es', 'serializers', 'es.Document.JsonSerializer.js')); |
Index: trunk/extensions/VisualEditor/modules/es/serializers/es.Document.HtmlSerializer.js |
— | — | @@ -58,9 +58,8 @@ |
59 | 59 | |
60 | 60 | es.Document.HtmlSerializer.prototype.serializeParagraph = function( paragraph, raw ) { |
61 | 61 | var out = []; |
62 | | - for ( var l = 0, lMax = paragraph.lines.length; l < lMax; l++ ) { |
63 | | - out.push( this.serializeLine( paragraph.lines[l] ) ); |
64 | | - } |
| 62 | + // XXX: fix content to be single oblect with text and annotations! |
| 63 | + out.push( this.serializeLine( paragraph.content[0] ) ); |
65 | 64 | if ( raw ) { |
66 | 65 | return out.join( '\n' ); |
67 | 66 | } else { |
Index: trunk/extensions/VisualEditor/modules/parser/pegParser.pegjs.txt |
— | — | @@ -116,17 +116,17 @@ |
117 | 117 | + ", matched: " + str.substr(0,m)); |
118 | 118 | // reverse parser position |
119 | 119 | pos -= str.length - m; |
120 | | - return str.substr(0,m); |
| 120 | + return {text: str.substr(0,m)}; |
121 | 121 | } else { |
122 | 122 | if (m == 0) { |
123 | 123 | pos -= str.length; |
124 | 124 | return null; |
125 | 125 | } else { |
126 | | - return str; |
| 126 | + return {text: str}; |
127 | 127 | } |
128 | 128 | } |
129 | 129 | } else { |
130 | | - return str; |
| 130 | + return {text: str}; |
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
— | — | @@ -143,17 +143,17 @@ |
144 | 144 | pos -= str.length - m; |
145 | 145 | dp("anyline reverse " + (str.length - m) |
146 | 146 | + ", matched: " + str.substr(0,m)); |
147 | | - return str.substr(0,m); |
| 147 | + return {text: str.substr(0,m)}; |
148 | 148 | } else { |
149 | 149 | if (m == 0) { |
150 | 150 | pos -= str.length; |
151 | 151 | return null; |
152 | 152 | } else { |
153 | | - return str; |
| 153 | + return {text : str}; |
154 | 154 | } |
155 | 155 | } |
156 | 156 | } else { |
157 | | - return str; |
| 157 | + return {text: str}; |
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
— | — | @@ -286,8 +286,8 @@ |
287 | 287 | } |
288 | 288 | if (text.length) { |
289 | 289 | out.push({ |
290 | | - type: 'text', |
291 | | - text: text |
| 290 | + text: text, |
| 291 | + //annotations: [] |
292 | 292 | }); |
293 | 293 | } |
294 | 294 | return out; |