Index: trunk/parsers/wikidom/tests/wikidom/wiki.test.js |
— | — | @@ -120,7 +120,7 @@ |
121 | 121 | 'annotations': [ |
122 | 122 | { |
123 | 123 | 'type': 'ilink', |
124 | | - 'range': { 'offset': 15, 'length': 4 }, |
| 124 | + 'range': { 'start': 15, 'end': 19 }, |
125 | 125 | 'data': { 'namespace': 'Main', 'title': 'Main_Page' } |
126 | 126 | } |
127 | 127 | ] |
— | — | @@ -163,8 +163,8 @@ |
164 | 164 | { |
165 | 165 | 'text': 'Line with bold and italic text', |
166 | 166 | 'annotations': [ |
167 | | - { 'type': 'bold', 'range': { 'offset': 10, 'length': 4 } }, |
168 | | - { 'type': 'italic', 'range': { 'offset': 19, 'length': 6 } } |
| 167 | + { 'type': 'bold', 'range': { 'start': 10, 'end': 14 } }, |
| 168 | + { 'type': 'italic', 'range': { 'start': 19, 'end': 25 } } |
169 | 169 | ] |
170 | 170 | } |
171 | 171 | ] |
Index: trunk/parsers/wikidom/lib/wiki.AnnotationRenderer.js |
— | — | @@ -16,8 +16,8 @@ |
17 | 17 | * Insertions for the same range will be nested in order of declaration. |
18 | 18 | * @example |
19 | 19 | * ar = new wiki.AnnotationRenderer(); |
20 | | - * ar.wrapWithText( { 'offset': 1, 'length': 1 }, '[', ']' ); |
21 | | - * ar.wrapWithText( { 'offset': 1, 'length': 1 }, '{', '}' ); |
| 20 | + * ar.wrapWithText( { 'start': 1, 'end': 2 }, '[', ']' ); |
| 21 | + * ar.wrapWithText( { 'start': 1, 'end': 2 }, '{', '}' ); |
22 | 22 | * // Outputs: "a[{b}]c" |
23 | 23 | * console.log( ar.apply( 'abc' ) ); |
24 | 24 | * |
— | — | @@ -26,17 +26,15 @@ |
27 | 27 | * @param post String: Text to insert after range |
28 | 28 | */ |
29 | 29 | this.wrapWithText = function( range, pre, post ) { |
30 | | - var start = range.offset; |
31 | | - if ( !( start in insertions ) ) { |
32 | | - insertions[start] = [pre]; |
| 30 | + if ( !( range.start in insertions ) ) { |
| 31 | + insertions[range.start] = [pre]; |
33 | 32 | } else { |
34 | | - insertions[start].push( pre ); |
| 33 | + insertions[range.start].push( pre ); |
35 | 34 | } |
36 | | - var end = range.offset + range.length; |
37 | | - if ( !( end in insertions ) ) { |
38 | | - insertions[end] = [post]; |
| 35 | + if ( !( range.end in insertions ) ) { |
| 36 | + insertions[range.end] = [post]; |
39 | 37 | } else { |
40 | | - insertions[end].unshift( post ); |
| 38 | + insertions[range.end].unshift( post ); |
41 | 39 | } |
42 | 40 | }; |
43 | 41 | |
Index: trunk/parsers/wikidom/lib/wiki.js |
— | — | @@ -37,8 +37,8 @@ |
38 | 38 | * line: Line object |
39 | 39 | * lists: Array of list objects |
40 | 40 | * range |
41 | | - * offset: Integer |
42 | | - * length: Integer |
| 41 | + * start: Integer |
| 42 | + * end: Integer |
43 | 43 | * annotation |
44 | 44 | * type: String |
45 | 45 | * range: Range object |
Index: trunk/parsers/wikidom/demos/renderers/document.js |
— | — | @@ -9,8 +9,8 @@ |
10 | 10 | { |
11 | 11 | "type": "italic", |
12 | 12 | "range": { |
13 | | - "offset": 10, |
14 | | - "length": 7 |
| 13 | + "start": 10, |
| 14 | + "end": 17 |
15 | 15 | } |
16 | 16 | } |
17 | 17 | ] |
— | — | @@ -83,15 +83,15 @@ |
84 | 84 | { |
85 | 85 | "type": "italic", |
86 | 86 | "range": { |
87 | | - "offset": 0, |
88 | | - "length": 4 |
| 87 | + "start": 0, |
| 88 | + "end": 4 |
89 | 89 | } |
90 | 90 | }, |
91 | 91 | { |
92 | 92 | "type": "xlink", |
93 | 93 | "range": { |
94 | | - "offset": 8, |
95 | | - "length": 6 |
| 94 | + "start": 8, |
| 95 | + "end": 22 |
96 | 96 | }, |
97 | 97 | "data": { |
98 | 98 | "url": "http://www.a.com" |
— | — | @@ -100,8 +100,8 @@ |
101 | 101 | { |
102 | 102 | "type": "bold", |
103 | 103 | "range": { |
104 | | - "offset": 10, |
105 | | - "length": 4 |
| 104 | + "start": 10, |
| 105 | + "end": 14 |
106 | 106 | } |
107 | 107 | } |
108 | 108 | ] |
— | — | @@ -112,15 +112,15 @@ |
113 | 113 | { |
114 | 114 | "type": "italic", |
115 | 115 | "range": { |
116 | | - "offset": 11, |
117 | | - "length": 3 |
| 116 | + "start": 11, |
| 117 | + "end": 14 |
118 | 118 | } |
119 | 119 | }, |
120 | 120 | { |
121 | 121 | "type": "bold", |
122 | 122 | "range": { |
123 | | - "offset": 20, |
124 | | - "length": 4 |
| 123 | + "start": 20, |
| 124 | + "end": 24 |
125 | 125 | } |
126 | 126 | } |
127 | 127 | ] |
— | — | @@ -136,8 +136,8 @@ |
137 | 137 | { |
138 | 138 | "type": "bold", |
139 | 139 | "range": { |
140 | | - "offset": 0, |
141 | | - "length": 9 |
| 140 | + "start": 0, |
| 141 | + "end": 9 |
142 | 142 | } |
143 | 143 | } |
144 | 144 | ] |
— | — | @@ -183,8 +183,8 @@ |
184 | 184 | { |
185 | 185 | "type": "italic", |
186 | 186 | "range": { |
187 | | - "offset": 0, |
188 | | - "length": 6 |
| 187 | + "start": 0, |
| 188 | + "end": 6 |
189 | 189 | } |
190 | 190 | } |
191 | 191 | ] |
— | — | @@ -197,8 +197,8 @@ |
198 | 198 | { |
199 | 199 | "type": "bold", |
200 | 200 | "range": { |
201 | | - "offset": 0, |
202 | | - "length": 5 |
| 201 | + "start": 0, |
| 202 | + "end": 5 |
203 | 203 | } |
204 | 204 | } |
205 | 205 | ] |
— | — | @@ -211,8 +211,8 @@ |
212 | 212 | { |
213 | 213 | "type": "ilink", |
214 | 214 | "range": { |
215 | | - "offset": 7, |
216 | | - "length": 4 |
| 215 | + "start": 7, |
| 216 | + "end": 12 |
217 | 217 | }, |
218 | 218 | "data": { |
219 | 219 | "title": "User:JohnDoe" |