Index: trunk/extensions/VisualEditor/modules/parser/pegTokenizer.pegjs.txt |
— | — | @@ -1031,16 +1031,22 @@ |
1032 | 1032 | "|-" |
1033 | 1033 | a:generic_attribute* |
1034 | 1034 | space* |
| 1035 | + // handle tables with missing table cells after a row |
| 1036 | + td:( s:sol !'!' tdt:table_data_tag { return s.concat(tdt); } )? |
1035 | 1037 | { |
1036 | 1038 | // We rely on our tree builder to close the row as needed. This is |
1037 | 1039 | // needed to support building tables from fragment templates with |
1038 | 1040 | // individual cells or rows. |
1039 | | - return [{type: 'TAG', name: 'tr', attribs: a}]; |
| 1041 | + var trToken = [{type: 'TAG', name: 'tr', attribs: a}]; |
| 1042 | + if ( !td ) { |
| 1043 | + return trToken; |
| 1044 | + } else { |
| 1045 | + return trToken.concat(td); |
| 1046 | + } |
1040 | 1047 | } |
1041 | 1048 | |
1042 | 1049 | table_data_tags |
1043 | | - = //("|" / !'!') // move the missing-'|' case to table_row_tag! |
1044 | | - "|" |
| 1050 | + = "|" |
1045 | 1051 | td:table_data_tag |
1046 | 1052 | tds:( "||" tdt:table_data_tag { return tdt } )* { |
1047 | 1053 | return td.concat(tds); |
— | — | @@ -1049,9 +1055,7 @@ |
1050 | 1056 | table_data_tag |
1051 | 1057 | = //& { dp("table_data enter, pos=" + pos + input.substr(pos,10)); return true; } |
1052 | 1058 | ! [}+-] |
1053 | | - //& { dp('before attrib, pos=' + pos); return true; } |
1054 | 1059 | a:table_cell_args? |
1055 | | - //& { dp('past attrib, pos=' + pos); return true; } |
1056 | 1060 | //& { console.log("past attrib, pos=" + pos + input.substr(pos,10)); return true; } |
1057 | 1061 | // use inline_breaks to break on tr etc |
1058 | 1062 | td:( !inline_breaks |