r91900 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91899‎ | r91900 | r91901 >
Date:18:53, 11 July 2011
Author:inez
Status:deferred
Tags:
Comment:
New convertAnnotations that supports new format
Modified paths:
  • /trunk/parsers/wikidom/tests/annotations/test.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/tests/annotations/test.js
@@ -121,24 +121,29 @@
122122
123123 function convertAnnotations( lines ) {
124124 for ( var i in lines ) {
 125+
125126 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+
127134 for ( var j in line.annotations ) {
128135 var annotation = line.annotations[j];
 136+
129137 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 );
134139 }
135140 }
 141+
136142 }
137143 }
 144+convertAnnotations( lines );
138145
139146 /* Tests */
140147
141 -convertAnnotations( lines );
142 -
143148 test( 'Multiline substrings produce correct plain text', function() {
144149 equals( multiLineSubstring( lines, 3, 39 ).text, 's is a test paragraph!\nParagraphs ca' );
145150 } );

Status & tagging log