Index: trunk/phase3/tests/parser/parserTests.txt |
— | — | @@ -1271,6 +1271,32 @@ |
1272 | 1272 | !! end |
1273 | 1273 | |
1274 | 1274 | !! test |
| 1275 | +Table inside unclosed table w/o cells |
| 1276 | +!! input |
| 1277 | +{| |
| 1278 | +{| |
| 1279 | +| foo bar |
| 1280 | +|} |
| 1281 | + |
| 1282 | +!! result |
| 1283 | +<table> |
| 1284 | +<tr> |
| 1285 | +<td> |
| 1286 | +<table> |
| 1287 | +<tr> |
| 1288 | +<td>foo bar |
| 1289 | +</td> |
| 1290 | +</tr> |
| 1291 | +</table> |
| 1292 | +<p><br /> |
| 1293 | +</p> |
| 1294 | +</td> |
| 1295 | +</tr> |
| 1296 | +</table> |
| 1297 | + |
| 1298 | +!! end |
| 1299 | + |
| 1300 | +!! test |
1275 | 1301 | Table with thead |
1276 | 1302 | !! input |
1277 | 1303 | {| |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -846,7 +846,6 @@ |
847 | 847 | $table =& $this->last( $tables ); |
848 | 848 | $table[0] = array(); // first row |
849 | 849 | $currentRow =& $table[0]; |
850 | | - |
851 | 850 | $table['indent'] = strlen( $matches[1] ); |
852 | 851 | |
853 | 852 | $attributes = $this->mStripState->unstripBoth( $matches[2] ); |
— | — | @@ -881,7 +880,7 @@ |
882 | 881 | } |
883 | 882 | $o = ''; |
884 | 883 | $curtable = array_pop( $tables ); |
885 | | - |
| 884 | + |
886 | 885 | #Add a line-ending before the table, but only if there isn't one already |
887 | 886 | if ( substr( $out, -1 ) !== "\n" ) { |
888 | 887 | $o .= "\n"; |
— | — | @@ -1052,6 +1051,7 @@ |
1053 | 1052 | // If we only have tbodies, mark table as simple |
1054 | 1053 | for ( $i = 0; isset( $table[$i] ); $i++ ) { |
1055 | 1054 | if ( !count( $table[$i] ) ) continue; |
| 1055 | + if ( !isset( $table[$i]['type'] ) ) $table[$i]['type'] = 'tbody'; |
1056 | 1056 | if ( !$lastSection ) { |
1057 | 1057 | $lastSection = $table[$i]['type']; |
1058 | 1058 | } else if ( $lastSection != $table[$i]['type'] ) { |
— | — | @@ -1075,6 +1075,7 @@ |
1076 | 1076 | $return .= isset( $table[$i]['attributes'] ) ? $table[$i]['attributes'] : ''; |
1077 | 1077 | $return .= '>'; |
1078 | 1078 | for ( $j = 0; isset( $table[$i][$j] ); $j++ ) { |
| 1079 | + if ( !isset( $table[$i][$j]['type'] ) ) $table[$i][$j]['type'] = 'td'; |
1079 | 1080 | $return .= "\n<" . $table[$i][$j]['type']; |
1080 | 1081 | $return .= isset( $table[$i][$j]['attributes'] ) ? $table[$i][$j]['attributes'] : ''; |
1081 | 1082 | $return .= '>'; |