Index: trunk/extensions/VisualEditor/modules/es/serializers/es.HtmlSerializer.js |
— | — | @@ -174,7 +174,8 @@ |
175 | 175 | attributes = es.HtmlSerializer.getHtmlAttributes( node.attributes ); |
176 | 176 | lines.push( es.Html.makeOpeningTag( 'table', attributes ) ); |
177 | 177 | for ( var i = 0, length = node.children.length; i < length; i++ ) { |
178 | | - lines.push( this.tableRow( node.children[i] ) ); |
| 178 | + var child = node.children[i]; |
| 179 | + lines.push( this[child.type]( child ) ); |
179 | 180 | } |
180 | 181 | lines.push( es.Html.makeClosingTag( 'table' ) ); |
181 | 182 | return lines.join( '\n' ); |
— | — | @@ -200,6 +201,11 @@ |
201 | 202 | return es.Html.makeTag( symbolTable[node.type], attributes, this.document( node, true ) ); |
202 | 203 | }; |
203 | 204 | |
| 205 | +es.HtmlSerializer.prototype.tableCaption = function( node ) { |
| 206 | + attributes = es.HtmlSerializer.getHtmlAttributes( node.attributes ); |
| 207 | + return es.Html.makeTag( 'caption', attributes, this.content( node.content ) ); |
| 208 | +}; |
| 209 | + |
204 | 210 | es.HtmlSerializer.prototype.transclusion = function( node ) { |
205 | 211 | var title = []; |
206 | 212 | if ( node.namespace !== 'Main' ) { |
Index: trunk/extensions/VisualEditor/modules/parser/pegParser.pegjs.txt |
— | — | @@ -632,9 +632,9 @@ |
633 | 633 | var res = {type: 'table'} |
634 | 634 | var body = b !== '' ? b : []; |
635 | 635 | if (c !== '') { |
636 | | - res.content = [c].concat(body); |
| 636 | + res.children = [c].concat(body); |
637 | 637 | } else { |
638 | | - res.content = body; |
| 638 | + res.children = body; |
639 | 639 | } |
640 | 640 | if (tas.length > 0) { |
641 | 641 | // FIXME: actually parse and build structure |
— | — | @@ -659,7 +659,7 @@ |
660 | 660 | = "|+" c:inline* newline? { |
661 | 661 | return { |
662 | 662 | type: 'tableCaption', |
663 | | - content: c |
| 663 | + content: c[0] |
664 | 664 | } |
665 | 665 | } |
666 | 666 | |
— | — | @@ -679,7 +679,7 @@ |
680 | 680 | = td:table_data+ { |
681 | 681 | return { |
682 | 682 | type: 'tableRow', |
683 | | - content: td |
| 683 | + children: td |
684 | 684 | }; |
685 | 685 | } |
686 | 686 | |
— | — | @@ -687,7 +687,7 @@ |
688 | 688 | = "|-" space* newline? td:(table_data / table_header)* { |
689 | 689 | return { |
690 | 690 | type: 'tableRow', |
691 | | - content: td |
| 691 | + children: td |
692 | 692 | }; |
693 | 693 | } |
694 | 694 | |
— | — | @@ -697,7 +697,7 @@ |
698 | 698 | //dp("table || result:" + print_r(td)); |
699 | 699 | return { |
700 | 700 | type: 'tableCell', |
701 | | - content: td |
| 701 | + children: td |
702 | 702 | }; |
703 | 703 | } |
704 | 704 | / & { dp("table_data : | enter pos=" + pos); return true; } |
— | — | @@ -705,7 +705,7 @@ |
706 | 706 | //dp("table | result:" + print_r(td)); |
707 | 707 | return { |
708 | 708 | type: 'tableCell', |
709 | | - content: td |
| 709 | + children: td |
710 | 710 | }; |
711 | 711 | } |
712 | 712 | |
— | — | @@ -717,14 +717,14 @@ |
718 | 718 | table_header |
719 | 719 | = "!!" c:(inline / ("!" !"!") / [^!\n])* newline? { |
720 | 720 | return { |
721 | | - type: 'tableHeader', |
722 | | - content: c |
| 721 | + type: 'tableHeading', |
| 722 | + children: c |
723 | 723 | } |
724 | 724 | } |
725 | 725 | / "!" c:(inline / text / '!' !'!' / [^!\n])* newline? { |
726 | 726 | return { |
727 | | - type: 'tableHeader', |
728 | | - content: c |
| 727 | + type: 'tableHeading', |
| 728 | + children: c |
729 | 729 | } |
730 | 730 | } |
731 | 731 | |