Index: trunk/parsers/wikidom/tests/hype/index.html |
— | — | @@ -13,12 +13,17 @@ |
14 | 14 | <script src="../../lib/jquery.js"></script> |
15 | 15 | <script src="../../lib/qunit.js"></script> |
16 | 16 | <script src="../../lib/hype/es.js"></script> |
17 | | - <script src="../../lib/synth/bases/es.AggregateArray.js"></script> |
18 | 17 | <script src="../../lib/hype/bases/es.EventEmitter.js"></script> |
19 | 18 | <script src="../../lib/hype/bases/es.ModelNode.js"></script> |
20 | 19 | <script src="../../lib/hype/bases/es.ViewNode.js"></script> |
21 | 20 | <script src="../../lib/hype/bases/es.DocumentModelNode.js"></script> |
22 | 21 | <script src="../../lib/hype/models/es.DocumentModel.js"></script> |
| 22 | + <script src="../../lib/hype/models/es.ListItemModel.js"></script> |
| 23 | + <script src="../../lib/hype/models/es.ListModel.js"></script> |
| 24 | + <script src="../../lib/hype/models/es.ParagraphModel.js"></script> |
| 25 | + <script src="../../lib/hype/models/es.TableCellModel.js"></script> |
| 26 | + <script src="../../lib/hype/models/es.TableModel.js"></script> |
| 27 | + <script src="../../lib/hype/models/es.TableRowModel.js"></script> |
23 | 28 | <script src="es.ModelNode.test.js"></script> |
24 | 29 | <script src="es.DocumentModel.test.js"></script> |
25 | 30 | </body> |
Index: trunk/parsers/wikidom/tests/hype/es.DocumentModel.test.js |
— | — | @@ -44,10 +44,10 @@ |
45 | 45 | 'type': 'table', |
46 | 46 | 'children': [ |
47 | 47 | { |
48 | | - 'type': 'row', |
| 48 | + 'type': 'tableRow', |
49 | 49 | 'children': [ |
50 | 50 | { |
51 | | - 'type': 'cell', |
| 51 | + 'type': 'tableCell', |
52 | 52 | 'children': [ |
53 | 53 | { |
54 | 54 | 'type': 'paragraph', |
— | — | @@ -132,9 +132,9 @@ |
133 | 133 | // 5 - Beginning of table |
134 | 134 | { 'type': 'table' }, |
135 | 135 | // 6 - Beginning of row |
136 | | - { 'type': 'row' }, |
| 136 | + { 'type': 'tableRow' }, |
137 | 137 | // 7 - Beginning of cell |
138 | | - { 'type': 'cell' }, |
| 138 | + { 'type': 'tableCell' }, |
139 | 139 | // 8 - Beginning of paragraph |
140 | 140 | { 'type': 'paragraph' }, |
141 | 141 | // 9 - Plain content |
— | — | @@ -164,9 +164,9 @@ |
165 | 165 | // 21 - End of list |
166 | 166 | { 'type': '/list' }, |
167 | 167 | // 22 - End of cell |
168 | | - { 'type': '/cell' }, |
| 168 | + { 'type': '/tableCell' }, |
169 | 169 | // 23 - End of row |
170 | | - { 'type': '/row' }, |
| 170 | + { 'type': '/tableRow' }, |
171 | 171 | // 24 - End of table |
172 | 172 | { 'type': '/table' }, |
173 | 173 | // 25 - Beginning of paragraph |
— | — | @@ -177,7 +177,7 @@ |
178 | 178 | { 'type': '/paragraph' } |
179 | 179 | ]; |
180 | 180 | |
181 | | -test( 'es.ModelNode', function() { |
| 181 | +test( 'es.DocumentModel', function() { |
182 | 182 | var documentModel = es.DocumentModel.newFromPlainObject( obj ); |
183 | 183 | |
184 | 184 | deepEqual( documentModel.getData(), data, 'Flattening plain objects results in correct data' ); |
Index: trunk/parsers/wikidom/lib/hype/models/es.DocumentModel.js |
— | — | @@ -18,6 +18,13 @@ |
19 | 19 | this.attributes = $.isPlainObject( attributes ) ? attributes : {}; |
20 | 20 | }; |
21 | 21 | |
| 22 | +/* Static Members */ |
| 23 | + |
| 24 | +/** |
| 25 | + * Mapping of symbolic names and node model constructors. |
| 26 | + */ |
| 27 | +es.DocumentModel.nodeModels = {}; |
| 28 | + |
22 | 29 | /* Static Methods */ |
23 | 30 | |
24 | 31 | /** |
Index: trunk/parsers/wikidom/lib/hype/models/es.TableRowModel.js |
— | — | @@ -0,0 +1,18 @@ |
| 2 | +/** |
| 3 | + * Creates an es.TableRowModel object. |
| 4 | + * |
| 5 | + * @class |
| 6 | + * @constructor |
| 7 | + */ |
| 8 | +es.TableRowModel = function( length ) { |
| 9 | + // Inheritance |
| 10 | + es.DocumentModelNode.call( this, length ); |
| 11 | +}; |
| 12 | + |
| 13 | +/* Registration */ |
| 14 | + |
| 15 | +es.DocumentModel.nodeModels.tableRow = es.TableRowModel; |
| 16 | + |
| 17 | +/* Inheritance */ |
| 18 | + |
| 19 | +es.extend( es.TableRowModel, es.DocumentModelNode ); |
Index: trunk/parsers/wikidom/lib/hype/models/es.ParagraphModel.js |
— | — | @@ -9,6 +9,10 @@ |
10 | 10 | es.DocumentModelNode.call( this, length ); |
11 | 11 | }; |
12 | 12 | |
| 13 | +/* Registration */ |
| 14 | + |
| 15 | +es.DocumentModel.nodeModels.paragraph = es.ParagraphModel; |
| 16 | + |
13 | 17 | /* Inheritance */ |
14 | 18 | |
15 | 19 | es.extend( es.ParagraphModel, es.DocumentModelNode ); |
Index: trunk/parsers/wikidom/lib/hype/models/es.TableCellModel.js |
— | — | @@ -0,0 +1,18 @@ |
| 2 | +/** |
| 3 | + * Creates an es.TableCellModel object. |
| 4 | + * |
| 5 | + * @class |
| 6 | + * @constructor |
| 7 | + */ |
| 8 | +es.TableCellModel = function( length ) { |
| 9 | + // Inheritance |
| 10 | + es.DocumentModelNode.call( this, length ); |
| 11 | +}; |
| 12 | + |
| 13 | +/* Registration */ |
| 14 | + |
| 15 | +es.DocumentModel.nodeModels.tableCell = es.TableCellModel; |
| 16 | + |
| 17 | +/* Inheritance */ |
| 18 | + |
| 19 | +es.extend( es.TableCellModel, es.DocumentModelNode ); |
Index: trunk/parsers/wikidom/lib/hype/models/es.TableModel.js |
— | — | @@ -0,0 +1,18 @@ |
| 2 | +/** |
| 3 | + * Creates an es.TableModel object. |
| 4 | + * |
| 5 | + * @class |
| 6 | + * @constructor |
| 7 | + */ |
| 8 | +es.TableModel = function( length ) { |
| 9 | + // Inheritance |
| 10 | + es.DocumentModelNode.call( this, length ); |
| 11 | +}; |
| 12 | + |
| 13 | +/* Registration */ |
| 14 | + |
| 15 | +es.DocumentModel.nodeModels.table = es.TableModel; |
| 16 | + |
| 17 | +/* Inheritance */ |
| 18 | + |
| 19 | +es.extend( es.TableModel, es.DocumentModelNode ); |
Index: trunk/parsers/wikidom/lib/hype/models/es.ListItemModel.js |
— | — | @@ -0,0 +1,18 @@ |
| 2 | +/** |
| 3 | + * Creates an es.ListItemModel object. |
| 4 | + * |
| 5 | + * @class |
| 6 | + * @constructor |
| 7 | + */ |
| 8 | +es.ListItemModel = function( length ) { |
| 9 | + // Inheritance |
| 10 | + es.DocumentModelNode.call( this, length ); |
| 11 | +}; |
| 12 | + |
| 13 | +/* Registration */ |
| 14 | + |
| 15 | +es.DocumentModel.nodeModels.listItem = es.ListItemModel; |
| 16 | + |
| 17 | +/* Inheritance */ |
| 18 | + |
| 19 | +es.extend( es.ListItemModel, es.DocumentModelNode ); |
Index: trunk/parsers/wikidom/lib/hype/models/es.ListModel.js |
— | — | @@ -0,0 +1,18 @@ |
| 2 | +/** |
| 3 | + * Creates an es.ListModel object. |
| 4 | + * |
| 5 | + * @class |
| 6 | + * @constructor |
| 7 | + */ |
| 8 | +es.ListModel = function( length ) { |
| 9 | + // Inheritance |
| 10 | + es.DocumentModelNode.call( this, length ); |
| 11 | +}; |
| 12 | + |
| 13 | +/* Registration */ |
| 14 | + |
| 15 | +es.DocumentModel.nodeModels.list = es.listModel; |
| 16 | + |
| 17 | +/* Inheritance */ |
| 18 | + |
| 19 | +es.extend( es.ListModel, es.DocumentModelNode ); |