Index: trunk/parsers/wikidom/tests/annotations/test.js |
— | — | @@ -121,24 +121,29 @@ |
122 | 122 | |
123 | 123 | function convertAnnotations( lines ) { |
124 | 124 | for ( var i in lines ) { |
| 125 | + |
125 | 126 | var line = lines[i]; |
126 | | - line.charAnnotations = []; |
| 127 | + |
| 128 | + line.content = []; |
| 129 | + |
| 130 | + for ( var j in line.text ) { |
| 131 | + line.content[j] = [line.text[j]]; |
| 132 | + } |
| 133 | + |
127 | 134 | for ( var j in line.annotations ) { |
128 | 135 | var annotation = line.annotations[j]; |
| 136 | + |
129 | 137 | for ( var k = annotation.range.start; k <= annotation.range.stop; k++ ) { |
130 | | - // Auto initialize |
131 | | - line.charAnnotations[k] || ( line.charAnnotations[k] = [] ); |
132 | | - // Append |
133 | | - line.charAnnotations[k].push( annotation ); |
| 138 | + line.content[k].push( annotation ); |
134 | 139 | } |
135 | 140 | } |
| 141 | + |
136 | 142 | } |
137 | 143 | } |
| 144 | +convertAnnotations( lines ); |
138 | 145 | |
139 | 146 | /* Tests */ |
140 | 147 | |
141 | | -convertAnnotations( lines ); |
142 | | - |
143 | 148 | test( 'Multiline substrings produce correct plain text', function() { |
144 | 149 | equals( multiLineSubstring( lines, 3, 39 ).text, 's is a test paragraph!\nParagraphs ca' ); |
145 | 150 | } ); |