Index: trunk/parsers/wikidom/tests/synth/index.html |
— | — | @@ -11,9 +11,9 @@ |
12 | 12 | <h2 id="qunit-userAgent"></h2> |
13 | 13 | <ol id="qunit-tests"></ol> |
14 | 14 | <script src="../../lib/synth/es.js"></script> |
15 | | - <script src="../../lib/synth/es.EventEmitter.js"></script> |
16 | | - <script src="../../lib/synth/es.Container.js"></script> |
17 | | - <script src="../../lib/synth/es.ContainerItem.js"></script> |
| 15 | + <script src="../../lib/synth/bases/es.EventEmitter.js"></script> |
| 16 | + <script src="../../lib/synth/bases/es.Container.js"></script> |
| 17 | + <script src="../../lib/synth/bases/es.ContainerItem.js"></script> |
18 | 18 | <script src="../../lib/jquery.js"></script> |
19 | 19 | <script src="../../lib/qunit.js"></script> |
20 | 20 | <script src="test.js"></script> |
Index: trunk/parsers/wikidom/tests/serializers/test.js |
— | — | @@ -54,7 +54,7 @@ |
55 | 55 | { |
56 | 56 | 'subject': 'horizontal rule', |
57 | 57 | 'dom': { 'blocks': [ { |
58 | | - 'type': 'horizontal-rule', |
| 58 | + 'type': 'horizontal-rule' |
59 | 59 | } ] }, |
60 | 60 | 'html': '<hr />', |
61 | 61 | 'wikitext': '----' |
Index: trunk/parsers/wikidom/lib/synth/models/es.DocumentModel.js |
— | — | @@ -30,7 +30,7 @@ |
31 | 31 | // Blocks - if given, convert all plain "block" objects to es.WikiDom* objects |
32 | 32 | !$.isArray( obj.blocks ) ? [] : $.map( obj.blocks, function( block ) { |
33 | 33 | return es.BlockModel.newFromPlainObject( block ); |
34 | | - }, |
| 34 | + } ), |
35 | 35 | // Attributes - if given, make a deep copy of attributes |
36 | 36 | !$.isPlainObject( obj.attributes ) ? {} : $.extend( true, {}, obj.attributes ) |
37 | 37 | ); |
Index: trunk/parsers/wikidom/lib/synth/models/es.TableBlockModel.js |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | // Cells - if given, convert plain "item" objects to es.ListModelItem objects |
30 | 30 | !$.isArray( obj.rows ) ? [] : $.map( obj.rows, function( row ) { |
31 | 31 | return !$.isPlainObject( row ) ? null : es.TableBlockRowModel.newFromPlainObject( row ) |
32 | | - } ) |
| 32 | + } ), |
33 | 33 | // Attributes - if given, make a deep copy of attributes |
34 | 34 | !$.isPlainObject( obj.attributes ) ? {} : $.extend( true, {}, obj.attributes ) |
35 | 35 | ); |
— | — | @@ -60,7 +60,7 @@ |
61 | 61 | } ); |
62 | 62 | } |
63 | 63 | if ( !$.isEmptyObject( this.attributes ) ) { |
64 | | - obj.attributes = $.extend( true, {}. this.attributes ); |
| 64 | + obj.attributes = $.extend( true, {}, this.attributes ); |
65 | 65 | } |
66 | 66 | return obj; |
67 | 67 | }; |
Index: trunk/parsers/wikidom/lib/synth/models/es.ContentModel.js |
— | — | @@ -213,11 +213,11 @@ |
214 | 214 | for ( var i = 0; i < this.data.length; i++ ) { |
215 | 215 | if ( this.data[i].length > 1 ) { |
216 | 216 | for ( var j = 1; j < this.data[i].length; j++ ) { |
217 | | - var float = es.Content.annotationRenderers[this.data[i][j].type].float; |
218 | | - if ( float && typeof float === 'function' ) { |
219 | | - float = float( this.data[i][j].data ); |
| 217 | + var isFloating = es.Content.annotationRenderers[this.data[i][j].type].float; |
| 218 | + if ( isFloating && typeof isFloating === 'function' ) { |
| 219 | + isFloating = isFloating( this.data[i][j].data ); |
220 | 220 | } |
221 | | - if ( float ) { |
| 221 | + if ( isFloating ) { |
222 | 222 | return true; |
223 | 223 | } |
224 | 224 | } |
— | — | @@ -239,18 +239,18 @@ |
240 | 240 | } |
241 | 241 | var start = offset, |
242 | 242 | end = offset, |
243 | | - char; |
| 243 | + character; |
244 | 244 | while ( start > 0 ) { |
245 | 245 | start--; |
246 | | - char = ( typeof this.data[start] === 'string' ? this.data[start] : this.data[start][0] ); |
247 | | - if ( char.match( /\B/ ) ) { |
| 246 | + character = ( typeof this.data[start] === 'string' ? this.data[start] : this.data[start][0] ); |
| 247 | + if ( character.match( /\B/ ) ) { |
248 | 248 | start++; |
249 | 249 | break; |
250 | 250 | } |
251 | 251 | } |
252 | 252 | while ( end < this.data.length ) { |
253 | | - char = ( typeof this.data[end] === 'string' ? this.data[end] : this.data[end][0] ); |
254 | | - if ( char.match( /\B/ ) ) { |
| 253 | + character = ( typeof this.data[end] === 'string' ? this.data[end] : this.data[end][0] ); |
| 254 | + if ( character.match( /\B/ ) ) { |
255 | 255 | break; |
256 | 256 | } |
257 | 257 | end++; |
Index: trunk/parsers/wikidom/lib/synth/models/es.TableBlockRowModel.js |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | // Cells - if given, convert plain "item" objects to es.ListModelItem objects |
27 | 27 | !$.isArray( obj.cells ) ? [] : $.map( obj.cells, function( cell ) { |
28 | 28 | return !$.isPlainObject( cell ) ? null : es.DocumentModel.newFromPlainObject( cell ) |
29 | | - } ) |
| 29 | + } ), |
30 | 30 | // Attributes - if given, make a deep copy of attributes |
31 | 31 | !$.isPlainObject( obj.attributes ) ? {} : $.extend( true, {}, obj.attributes ) |
32 | 32 | ); |
— | — | @@ -57,7 +57,7 @@ |
58 | 58 | } ); |
59 | 59 | } |
60 | 60 | if ( !$.isEmptyObject( this.attributes ) ) { |
61 | | - obj.attributes = $.extend( true, {}. this.attributes ); |
| 61 | + obj.attributes = $.extend( true, {}, this.attributes ); |
62 | 62 | } |
63 | 63 | return obj; |
64 | 64 | }; |
Index: trunk/parsers/wikidom/lib/synth/bases/es.ContentSeries.js |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | |
47 | 47 | es.ContentSeries.prototype.size = function() { |
48 | 48 | var sum = 0; |
49 | | - for ( var i = 0, length = this.length; i++ ) { |
| 49 | + for ( var i = 0, length = this.length; i < length; i++ ) { |
50 | 50 | sum += this[i].getLength(); |
51 | 51 | } |
52 | 52 | return sum; |
Index: trunk/parsers/wikidom/lib/synth/views/es.ContentView.js |
— | — | @@ -547,8 +547,8 @@ |
548 | 548 | */ |
549 | 549 | es.ContentView.prototype.appendLine = function( range, wordOffset, fractional ) { |
550 | 550 | var rs = this.renderState, |
551 | | - lineCount = rs.lines.length; |
552 | | - $line = this.$.children( '[line-index=' + lineCount + ']' ); |
| 551 | + lineCount = rs.lines.length, |
| 552 | + $line = this.$.children( '[line-index=' + lineCount + ']' ); |
553 | 553 | if ( !$line.length ) { |
554 | 554 | $line = $( '<div class="editSurface-line" line-index="' + lineCount + '"></div>' ); |
555 | 555 | this.$.append( $line ); |
— | — | @@ -600,6 +600,7 @@ |
601 | 601 | end = range.end, |
602 | 602 | charOffset = this.boundaries[offset], |
603 | 603 | middle, |
| 604 | + charMiddle, |
604 | 605 | lineWidth, |
605 | 606 | cacheKey; |
606 | 607 | do { |
Index: trunk/parsers/wikidom/lib/es/es.ContentFlow.js |
— | — | @@ -415,8 +415,8 @@ |
416 | 416 | */ |
417 | 417 | es.ContentFlow.prototype.appendLine = function( range, wordOffset, fractional ) { |
418 | 418 | var rs = this.renderState, |
419 | | - lineCount = rs.lines.length; |
420 | | - $line = this.$.children( '[line-index=' + lineCount + ']' ); |
| 419 | + lineCount = rs.lines.length, |
| 420 | + $line = this.$.children( '[line-index=' + lineCount + ']' ); |
421 | 421 | if ( !$line.length ) { |
422 | 422 | $line = $( '<div class="editSurface-line" line-index="' + lineCount + '"></div>' ); |
423 | 423 | this.$.append( $line ); |
— | — | @@ -468,6 +468,7 @@ |
469 | 469 | end = range.end, |
470 | 470 | charOffset = this.boundaries[offset], |
471 | 471 | middle, |
| 472 | + charMiddle, |
472 | 473 | lineWidth, |
473 | 474 | cacheKey; |
474 | 475 | do { |
Index: trunk/parsers/wikidom/lib/es/es.Content.js |
— | — | @@ -370,11 +370,11 @@ |
371 | 371 | for ( var i = 0; i < this.data.length; i++ ) { |
372 | 372 | if ( this.data[i].length > 1 ) { |
373 | 373 | for ( var j = 1; j < this.data[i].length; j++ ) { |
374 | | - var float = es.Content.annotationRenderers[this.data[i][j].type].float; |
375 | | - if ( float && typeof float === 'function' ) { |
376 | | - float = float( this.data[i][j].data ); |
| 374 | + var isFloating = es.Content.annotationRenderers[this.data[i][j].type].float; |
| 375 | + if ( isFloating && typeof isFloating === 'function' ) { |
| 376 | + isFloating = isFloating( this.data[i][j].data ); |
377 | 377 | } |
378 | | - if ( float ) { |
| 378 | + if ( isFloating ) { |
379 | 379 | return true; |
380 | 380 | } |
381 | 381 | } |
— | — | @@ -685,18 +685,18 @@ |
686 | 686 | } |
687 | 687 | var start = offset, |
688 | 688 | end = offset, |
689 | | - char; |
| 689 | + character; |
690 | 690 | while ( start > 0 ) { |
691 | 691 | start--; |
692 | | - char = ( typeof this.data[start] === 'string' ? this.data[start] : this.data[start][0] ); |
693 | | - if ( char.match( /\B/ ) ) { |
| 692 | + character = ( typeof this.data[start] === 'string' ? this.data[start] : this.data[start][0] ); |
| 693 | + if ( character.match( /\B/ ) ) { |
694 | 694 | start++; |
695 | 695 | break; |
696 | 696 | } |
697 | 697 | } |
698 | 698 | while ( end < this.data.length ) { |
699 | | - char = ( typeof this.data[end] === 'string' ? this.data[end] : this.data[end][0] ); |
700 | | - if ( char.match( /\B/ ) ) { |
| 699 | + character = ( typeof this.data[end] === 'string' ? this.data[end] : this.data[end][0] ); |
| 700 | + if ( character.match( /\B/ ) ) { |
701 | 701 | break; |
702 | 702 | } |
703 | 703 | end++; |
Index: trunk/parsers/wikidom/lib/es/es.Surface.js |
— | — | @@ -83,7 +83,7 @@ |
84 | 84 | }, |
85 | 85 | 'keyup.editSurface' : function( e ) { |
86 | 86 | return surface.onKeyUp( e ); |
87 | | - }, |
| 87 | + } |
88 | 88 | }); |
89 | 89 | }, |
90 | 90 | 'blur': function( e ) { |
— | — | @@ -121,12 +121,12 @@ |
122 | 122 | } |
123 | 123 | |
124 | 124 | es.Surface.prototype.getLocationFromEvent = function( e ) { |
125 | | - var $target = $( e.target ); |
| 125 | + var $target = $( e.target ), |
126 | 126 | $block = $target.is( '.editSurface-block' ) |
127 | 127 | ? $target : $target.closest( '.editSurface-block' ); |
128 | 128 | // Not a block or child of a block? Find the nearest block... |
129 | 129 | if( !$block.length ) { |
130 | | - $blocks = this.$.find( '> .editSurface-document .editSurface-block' ); |
| 130 | + var $blocks = this.$.find( '> .editSurface-document .editSurface-block' ); |
131 | 131 | $block = $blocks.first(); |
132 | 132 | $blocks.each( function() { |
133 | 133 | // Stop looking when mouse is above top |
Index: trunk/parsers/wikidom/demos/es/es.js |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | $(document).ready( function() { |
3 | 3 | var showData = false; |
4 | | - doc = es.Document.newFromWikiDomDocument( { 'blocks': [ |
| 4 | + var doc = es.Document.newFromWikiDomDocument( { 'blocks': [ |
5 | 5 | { |
6 | 6 | "type": "paragraph", |
7 | 7 | "lines": [ |
Index: trunk/parsers/wikidom/demos/surface/jquery.flow.js |
— | — | @@ -61,15 +61,15 @@ |
62 | 62 | } |
63 | 63 | |
64 | 64 | $.flow = { |
65 | | - 'charCache': {}, |
| 65 | + 'characterCache': {}, |
66 | 66 | 'wordCache': {}, |
67 | 67 | 'measureWord': function( text, ruler ) { |
68 | 68 | if ( typeof $.flow.wordCache[text] === 'undefined' ) { |
69 | 69 | // Cache miss |
70 | 70 | var word = { 'text': text, 'html': '', 'metrics': [] }; |
71 | 71 | for ( var i = 0; i < text.length; i++ ) { |
72 | | - var char = text[i], |
73 | | - charHtml = char |
| 72 | + var character = text[i], |
| 73 | + characterHtml = character |
74 | 74 | .replace( '&', '&' ) |
75 | 75 | .replace( ' ', ' ' ) |
76 | 76 | .replace( '<', '<' ) |
— | — | @@ -78,15 +78,15 @@ |
79 | 79 | .replace( '"', '"' ) |
80 | 80 | .replace( '\n', '<span class="editSurface-whitespace">\\n</span>' ) |
81 | 81 | .replace( '\t', '<span class="editSurface-whitespace">\\t</span>' ); |
82 | | - word.html += charHtml; |
83 | | - if ( typeof $.flow.charCache[char] === 'undefined' ) { |
| 82 | + word.html += characterHtml; |
| 83 | + if ( typeof $.flow.characterCache[character] === 'undefined' ) { |
84 | 84 | // Cache miss |
85 | | - ruler.innerHTML = charHtml; |
86 | | - word.metrics.push( $.flow.charCache[char] = ruler.clientWidth ); |
| 85 | + ruler.innerHTML = characterHtml; |
| 86 | + word.metrics.push( $.flow.characterCache[character] = ruler.clientWidth ); |
87 | 87 | continue; |
88 | 88 | } |
89 | 89 | // Cache hit |
90 | | - word.metrics.push( $.flow.charCache[char] ); |
| 90 | + word.metrics.push( $.flow.characterCache[character] ); |
91 | 91 | } |
92 | 92 | ruler.innerHTML = word.html; |
93 | 93 | word.width = ruler.clientWidth; |
— | — | @@ -116,7 +116,7 @@ |
117 | 117 | 'getLines': function( words, width ) { |
118 | 118 | // Lineify |
119 | 119 | var lineCount = 0, |
120 | | - charCount = 0, |
| 120 | + characterCount = 0, |
121 | 121 | wordCount = 0, |
122 | 122 | lines = [], |
123 | 123 | line = { |
— | — | @@ -130,7 +130,7 @@ |
131 | 131 | for ( var i = 0; i < words.length; i++ ) { |
132 | 132 | if ( line.width + words[i].width > width ) { |
133 | 133 | lines.push( line ); |
134 | | - charCount = 0; |
| 134 | + characterCount = 0; |
135 | 135 | wordCount = 0; |
136 | 136 | lineCount++; |
137 | 137 | line = { |
— | — | @@ -144,8 +144,8 @@ |
145 | 145 | } |
146 | 146 | words[i].index = wordCount; |
147 | 147 | wordCount++; |
148 | | - words[i].offset = charCount; |
149 | | - charCount += words[i].text.length; |
| 148 | + words[i].offset = characterCount; |
| 149 | + characterCount += words[i].text.length; |
150 | 150 | line.words.push( words[i] ); |
151 | 151 | line.text += words[i].text; |
152 | 152 | line.html += words[i].html; |
Index: trunk/parsers/wikidom/demos/surface/jquery.editSurface.js |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | $.fn.editSurface = function( options ) { |
3 | 3 | var $this = $(this); |
4 | | - sel = { |
| 4 | + var sel = { |
5 | 5 | 'active': false |
6 | 6 | }; |
7 | 7 | |
Index: trunk/parsers/wikidom/demos/renderers/document.js |
— | — | @@ -1,227 +0,0 @@ |
2 | | -{ |
3 | | - "blocks": [ |
4 | | - { |
5 | | - "type": "heading", |
6 | | - "level": 2, |
7 | | - "line": { |
8 | | - "text": "This is a heading", |
9 | | - "annotations": [ |
10 | | - { |
11 | | - "type": "italic", |
12 | | - "range": { |
13 | | - "start": 10, |
14 | | - "end": 17 |
15 | | - } |
16 | | - } |
17 | | - ] |
18 | | - } |
19 | | - }, |
20 | | - { |
21 | | - "type": "rule" |
22 | | - }, |
23 | | - { |
24 | | - "type": "comment", |
25 | | - "text": "Hello wild world of wikitext!" |
26 | | - }, |
27 | | - { |
28 | | - "type": "table", |
29 | | - "attributes": { |
30 | | - "class": "wikitable", |
31 | | - "width": "50%" |
32 | | - }, |
33 | | - "rows": [ |
34 | | - [ |
35 | | - { |
36 | | - "type": "heading", |
37 | | - "document": { |
38 | | - "blocks": [ |
39 | | - { |
40 | | - "type": "paragraph", |
41 | | - "lines": [ |
42 | | - { |
43 | | - "text": "This is a table heading" |
44 | | - } |
45 | | - ] |
46 | | - } |
47 | | - ] |
48 | | - } |
49 | | - } |
50 | | - ], |
51 | | - [ |
52 | | - { |
53 | | - "type": "data", |
54 | | - "document": { |
55 | | - "blocks": [ |
56 | | - { |
57 | | - "type": "paragraph", |
58 | | - "lines": [ |
59 | | - { |
60 | | - "text": "This is a table cell" |
61 | | - } |
62 | | - ] |
63 | | - }, |
64 | | - { |
65 | | - "type": "paragraph", |
66 | | - "lines": [ |
67 | | - { |
68 | | - "text": "This is another paragraph in a table cell" |
69 | | - } |
70 | | - ] |
71 | | - } |
72 | | - ] |
73 | | - } |
74 | | - } |
75 | | - ] |
76 | | - ] |
77 | | - }, |
78 | | - { |
79 | | - "type": "paragraph", |
80 | | - "lines": [ |
81 | | - { |
82 | | - "text": "This is a test paragraph!", |
83 | | - "annotations": [ |
84 | | - { |
85 | | - "type": "italic", |
86 | | - "range": { |
87 | | - "start": 0, |
88 | | - "end": 4 |
89 | | - } |
90 | | - }, |
91 | | - { |
92 | | - "type": "xlink", |
93 | | - "range": { |
94 | | - "start": 8, |
95 | | - "end": 22 |
96 | | - }, |
97 | | - "data": { |
98 | | - "url": "http://www.a.com" |
99 | | - } |
100 | | - }, |
101 | | - { |
102 | | - "type": "bold", |
103 | | - "range": { |
104 | | - "start": 10, |
105 | | - "end": 14 |
106 | | - } |
107 | | - } |
108 | | - ] |
109 | | - }, |
110 | | - { |
111 | | - "text": "Paragraphs can have more than one line.", |
112 | | - "annotations": [ |
113 | | - { |
114 | | - "type": "italic", |
115 | | - "range": { |
116 | | - "start": 11, |
117 | | - "end": 14 |
118 | | - } |
119 | | - }, |
120 | | - { |
121 | | - "type": "bold", |
122 | | - "range": { |
123 | | - "start": 20, |
124 | | - "end": 24 |
125 | | - } |
126 | | - } |
127 | | - ] |
128 | | - } |
129 | | - ] |
130 | | - }, |
131 | | - { |
132 | | - "type": "paragraph", |
133 | | - "lines": [ |
134 | | - { |
135 | | - "text": "Documents can have one or more blocks.", |
136 | | - "annotations": [ |
137 | | - { |
138 | | - "type": "bold", |
139 | | - "range": { |
140 | | - "start": 0, |
141 | | - "end": 9 |
142 | | - } |
143 | | - } |
144 | | - ] |
145 | | - } |
146 | | - ] |
147 | | - }, |
148 | | - { |
149 | | - "type": "list", |
150 | | - "style": "number", |
151 | | - "items": [ |
152 | | - { |
153 | | - "line": { |
154 | | - "text": "First item" |
155 | | - }, |
156 | | - "lists": [ |
157 | | - { |
158 | | - "type": "list", |
159 | | - "style": "bullet", |
160 | | - "items": [ |
161 | | - { |
162 | | - "line": { |
163 | | - "text": "First sub-item" |
164 | | - } |
165 | | - }, |
166 | | - { |
167 | | - "line": { |
168 | | - "text": "Second sub-item" |
169 | | - } |
170 | | - }, |
171 | | - { |
172 | | - "line": { |
173 | | - "text": "Third sub-item" |
174 | | - } |
175 | | - } |
176 | | - ] |
177 | | - } |
178 | | - ] |
179 | | - }, |
180 | | - { |
181 | | - "line": { |
182 | | - "text": "Second item", |
183 | | - "annotations": [ |
184 | | - { |
185 | | - "type": "italic", |
186 | | - "range": { |
187 | | - "start": 0, |
188 | | - "end": 6 |
189 | | - } |
190 | | - } |
191 | | - ] |
192 | | - } |
193 | | - }, |
194 | | - { |
195 | | - "line": { |
196 | | - "text": "Third item", |
197 | | - "annotations": [ |
198 | | - { |
199 | | - "type": "bold", |
200 | | - "range": { |
201 | | - "start": 0, |
202 | | - "end": 5 |
203 | | - } |
204 | | - } |
205 | | - ] |
206 | | - } |
207 | | - }, |
208 | | - { |
209 | | - "line": { |
210 | | - "text": "Fourth item", |
211 | | - "annotations": [ |
212 | | - { |
213 | | - "type": "ilink", |
214 | | - "range": { |
215 | | - "start": 7, |
216 | | - "end": 12 |
217 | | - }, |
218 | | - "data": { |
219 | | - "title": "User:JohnDoe" |
220 | | - } |
221 | | - } |
222 | | - ] |
223 | | - } |
224 | | - } |
225 | | - ] |
226 | | - } |
227 | | - ] |
228 | | -} |
\ No newline at end of file |
Index: trunk/parsers/wikidom/demos/renderers/document.json |
— | — | @@ -0,0 +1,227 @@ |
| 2 | +{ |
| 3 | + "blocks": [ |
| 4 | + { |
| 5 | + "type": "heading", |
| 6 | + "level": 2, |
| 7 | + "line": { |
| 8 | + "text": "This is a heading", |
| 9 | + "annotations": [ |
| 10 | + { |
| 11 | + "type": "italic", |
| 12 | + "range": { |
| 13 | + "start": 10, |
| 14 | + "end": 17 |
| 15 | + } |
| 16 | + } |
| 17 | + ] |
| 18 | + } |
| 19 | + }, |
| 20 | + { |
| 21 | + "type": "rule" |
| 22 | + }, |
| 23 | + { |
| 24 | + "type": "comment", |
| 25 | + "text": "Hello wild world of wikitext!" |
| 26 | + }, |
| 27 | + { |
| 28 | + "type": "table", |
| 29 | + "attributes": { |
| 30 | + "class": "wikitable", |
| 31 | + "width": "50%" |
| 32 | + }, |
| 33 | + "rows": [ |
| 34 | + [ |
| 35 | + { |
| 36 | + "type": "heading", |
| 37 | + "document": { |
| 38 | + "blocks": [ |
| 39 | + { |
| 40 | + "type": "paragraph", |
| 41 | + "lines": [ |
| 42 | + { |
| 43 | + "text": "This is a table heading" |
| 44 | + } |
| 45 | + ] |
| 46 | + } |
| 47 | + ] |
| 48 | + } |
| 49 | + } |
| 50 | + ], |
| 51 | + [ |
| 52 | + { |
| 53 | + "type": "data", |
| 54 | + "document": { |
| 55 | + "blocks": [ |
| 56 | + { |
| 57 | + "type": "paragraph", |
| 58 | + "lines": [ |
| 59 | + { |
| 60 | + "text": "This is a table cell" |
| 61 | + } |
| 62 | + ] |
| 63 | + }, |
| 64 | + { |
| 65 | + "type": "paragraph", |
| 66 | + "lines": [ |
| 67 | + { |
| 68 | + "text": "This is another paragraph in a table cell" |
| 69 | + } |
| 70 | + ] |
| 71 | + } |
| 72 | + ] |
| 73 | + } |
| 74 | + } |
| 75 | + ] |
| 76 | + ] |
| 77 | + }, |
| 78 | + { |
| 79 | + "type": "paragraph", |
| 80 | + "lines": [ |
| 81 | + { |
| 82 | + "text": "This is a test paragraph!", |
| 83 | + "annotations": [ |
| 84 | + { |
| 85 | + "type": "italic", |
| 86 | + "range": { |
| 87 | + "start": 0, |
| 88 | + "end": 4 |
| 89 | + } |
| 90 | + }, |
| 91 | + { |
| 92 | + "type": "xlink", |
| 93 | + "range": { |
| 94 | + "start": 8, |
| 95 | + "end": 22 |
| 96 | + }, |
| 97 | + "data": { |
| 98 | + "url": "http://www.a.com" |
| 99 | + } |
| 100 | + }, |
| 101 | + { |
| 102 | + "type": "bold", |
| 103 | + "range": { |
| 104 | + "start": 10, |
| 105 | + "end": 14 |
| 106 | + } |
| 107 | + } |
| 108 | + ] |
| 109 | + }, |
| 110 | + { |
| 111 | + "text": "Paragraphs can have more than one line.", |
| 112 | + "annotations": [ |
| 113 | + { |
| 114 | + "type": "italic", |
| 115 | + "range": { |
| 116 | + "start": 11, |
| 117 | + "end": 14 |
| 118 | + } |
| 119 | + }, |
| 120 | + { |
| 121 | + "type": "bold", |
| 122 | + "range": { |
| 123 | + "start": 20, |
| 124 | + "end": 24 |
| 125 | + } |
| 126 | + } |
| 127 | + ] |
| 128 | + } |
| 129 | + ] |
| 130 | + }, |
| 131 | + { |
| 132 | + "type": "paragraph", |
| 133 | + "lines": [ |
| 134 | + { |
| 135 | + "text": "Documents can have one or more blocks.", |
| 136 | + "annotations": [ |
| 137 | + { |
| 138 | + "type": "bold", |
| 139 | + "range": { |
| 140 | + "start": 0, |
| 141 | + "end": 9 |
| 142 | + } |
| 143 | + } |
| 144 | + ] |
| 145 | + } |
| 146 | + ] |
| 147 | + }, |
| 148 | + { |
| 149 | + "type": "list", |
| 150 | + "style": "number", |
| 151 | + "items": [ |
| 152 | + { |
| 153 | + "line": { |
| 154 | + "text": "First item" |
| 155 | + }, |
| 156 | + "lists": [ |
| 157 | + { |
| 158 | + "type": "list", |
| 159 | + "style": "bullet", |
| 160 | + "items": [ |
| 161 | + { |
| 162 | + "line": { |
| 163 | + "text": "First sub-item" |
| 164 | + } |
| 165 | + }, |
| 166 | + { |
| 167 | + "line": { |
| 168 | + "text": "Second sub-item" |
| 169 | + } |
| 170 | + }, |
| 171 | + { |
| 172 | + "line": { |
| 173 | + "text": "Third sub-item" |
| 174 | + } |
| 175 | + } |
| 176 | + ] |
| 177 | + } |
| 178 | + ] |
| 179 | + }, |
| 180 | + { |
| 181 | + "line": { |
| 182 | + "text": "Second item", |
| 183 | + "annotations": [ |
| 184 | + { |
| 185 | + "type": "italic", |
| 186 | + "range": { |
| 187 | + "start": 0, |
| 188 | + "end": 6 |
| 189 | + } |
| 190 | + } |
| 191 | + ] |
| 192 | + } |
| 193 | + }, |
| 194 | + { |
| 195 | + "line": { |
| 196 | + "text": "Third item", |
| 197 | + "annotations": [ |
| 198 | + { |
| 199 | + "type": "bold", |
| 200 | + "range": { |
| 201 | + "start": 0, |
| 202 | + "end": 5 |
| 203 | + } |
| 204 | + } |
| 205 | + ] |
| 206 | + } |
| 207 | + }, |
| 208 | + { |
| 209 | + "line": { |
| 210 | + "text": "Fourth item", |
| 211 | + "annotations": [ |
| 212 | + { |
| 213 | + "type": "ilink", |
| 214 | + "range": { |
| 215 | + "start": 7, |
| 216 | + "end": 12 |
| 217 | + }, |
| 218 | + "data": { |
| 219 | + "title": "User:JohnDoe" |
| 220 | + } |
| 221 | + } |
| 222 | + ] |
| 223 | + } |
| 224 | + } |
| 225 | + ] |
| 226 | + } |
| 227 | + ] |
| 228 | +} |
\ No newline at end of file |
Property changes on: trunk/parsers/wikidom/demos/renderers/document.json |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 229 | + native |
Added: svn:mime-type |
2 | 230 | + text/plain |
Index: trunk/parsers/wikidom/demos/renderers/index.html |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | </head> |
49 | 49 | <body> |
50 | 50 | <p> |
51 | | - This page use <a href="document.js">a JSON representation of wikitext</a> as input to two renderers: wikitext and HTML. The JSON source is appended at the end of the document for reference.</p> |
| 51 | + This page use <a href="document.json">a JSON representation of wikitext</a> as input to two renderers: wikitext and HTML. The JSON source is appended at the end of the document for reference.</p> |
52 | 52 | <h2>HTML Rendering</h2> |
53 | 53 | <div id="html-rendering" class="render"></div> |
54 | 54 | <h2>HTML Source</h2> |
— | — | @@ -60,6 +60,7 @@ |
61 | 61 | <script src="../../lib/es/es.js"></script> |
62 | 62 | <script src="../../lib/es/es.EventEmitter.js"></script> |
63 | 63 | <script src="../../lib/es/es.Container.js"></script> |
| 64 | + <script src="../../lib/es/es.DomContainer.js"></script> |
64 | 65 | <script src="../../lib/es/es.AnnotationSerializer.js"></script> |
65 | 66 | <script src="../../lib/es/es.Document.js"></script> |
66 | 67 | <script src="../../lib/es/es.Document.Context.js"></script> |
— | — | @@ -69,7 +70,7 @@ |
70 | 71 | <script src="../../lib/es/es.Document.JsonSerializer.js"></script> |
71 | 72 | <script> |
72 | 73 | $( document ).ready( function() { |
73 | | - $.getJSON( 'document.js', function( data ) { |
| 74 | + $.getJSON( 'document.json', function( data ) { |
74 | 75 | var context = new es.Document.Context(), |
75 | 76 | htmlSerializer = new es.Document.HtmlSerializer( context ), |
76 | 77 | wikitextSerializer = new es.Document.WikitextSerializer( context ), |