Index: trunk/phase3/tests/parser/parserTests.txt |
— | — | @@ -1210,8 +1210,7 @@ |
1211 | 1211 | |} |
1212 | 1212 | !! result |
1213 | 1213 | <table> |
1214 | | -<caption> |
1215 | | -caption |
| 1214 | +<caption> caption |
1216 | 1215 | </caption><tr><td></td></tr></table> |
1217 | 1216 | |
1218 | 1217 | !! end |
— | — | @@ -1227,22 +1226,12 @@ |
1228 | 1227 | !! result |
1229 | 1228 | <table> |
1230 | 1229 | <tr> |
1231 | | -<td> |
1232 | | -<p>1 |
1233 | | -</p> |
1234 | | -</td> |
1235 | | -<td> |
1236 | | -<p>2 |
1237 | | -</p> |
| 1230 | +<td> 1 </td> |
| 1231 | +<td> 2 |
1238 | 1232 | </td></tr> |
1239 | 1233 | <tr> |
1240 | | -<td> |
1241 | | -<p>3 |
1242 | | -</p> |
1243 | | -</td> |
1244 | | -<td> |
1245 | | -<p>4 |
1246 | | -</p> |
| 1234 | +<td> 3 </td> |
| 1235 | +<td> 4 |
1247 | 1236 | </td></tr></table> |
1248 | 1237 | |
1249 | 1238 | !! end |
— | — | @@ -1272,110 +1261,48 @@ |
1273 | 1262 | |} |
1274 | 1263 | !! result |
1275 | 1264 | <table border="1" cellpadding="2"> |
1276 | | -<caption> |
1277 | | -Multiplication table |
| 1265 | +<caption>Multiplication table |
1278 | 1266 | </caption> |
1279 | 1267 | <tr> |
1280 | | -<th> |
1281 | | -<p>× |
1282 | | -</p> |
1283 | | -</th> |
1284 | | -<th> |
1285 | | -<p>1 |
1286 | | -</p> |
1287 | | -</th> |
1288 | | -<th> |
1289 | | -<p>2 |
1290 | | -</p> |
1291 | | -</th> |
1292 | | -<th> |
1293 | | -<p>3 |
1294 | | -</p> |
| 1268 | +<th> × </th> |
| 1269 | +<th> 1 </th> |
| 1270 | +<th> 2 </th> |
| 1271 | +<th> 3 |
1295 | 1272 | </th></tr> |
1296 | 1273 | <tr> |
1297 | | -<th> |
1298 | | -<p>1 |
1299 | | -</p> |
| 1274 | +<th> 1 |
1300 | 1275 | </th> |
1301 | | -<td> |
1302 | | -<p>1 |
1303 | | -</p> |
1304 | | -</td> |
1305 | | -<td> |
1306 | | -<p>2 |
1307 | | -</p> |
1308 | | -</td> |
1309 | | -<td> |
1310 | | -<p>3 |
1311 | | -</p> |
| 1276 | +<td> 1 </td> |
| 1277 | +<td> 2 </td> |
| 1278 | +<td> 3 |
1312 | 1279 | </td></tr> |
1313 | 1280 | <tr> |
1314 | | -<th> |
1315 | | -<p>2 |
1316 | | -</p> |
| 1281 | +<th> 2 |
1317 | 1282 | </th> |
1318 | | -<td> |
1319 | | -<p>2 |
1320 | | -</p> |
1321 | | -</td> |
1322 | | -<td> |
1323 | | -<p>4 |
1324 | | -</p> |
1325 | | -</td> |
1326 | | -<td> |
1327 | | -<p>6 |
1328 | | -</p> |
| 1283 | +<td> 2 </td> |
| 1284 | +<td> 4 </td> |
| 1285 | +<td> 6 |
1329 | 1286 | </td></tr> |
1330 | 1287 | <tr> |
1331 | | -<th> |
1332 | | -<p>3 |
1333 | | -</p> |
| 1288 | +<th> 3 |
1334 | 1289 | </th> |
1335 | | -<td> |
1336 | | -<p>3 |
1337 | | -</p> |
1338 | | -</td> |
1339 | | -<td> |
1340 | | -<p>6 |
1341 | | -</p> |
1342 | | -</td> |
1343 | | -<td> |
1344 | | -<p>9 |
1345 | | -</p> |
| 1290 | +<td> 3 </td> |
| 1291 | +<td> 6 </td> |
| 1292 | +<td> 9 |
1346 | 1293 | </td></tr> |
1347 | 1294 | <tr> |
1348 | | -<th> |
1349 | | -<p>4 |
1350 | | -</p> |
| 1295 | +<th> 4 |
1351 | 1296 | </th> |
1352 | | -<td> |
1353 | | -<p>4 |
1354 | | -</p> |
1355 | | -</td> |
1356 | | -<td> |
1357 | | -<p>8 |
1358 | | -</p> |
1359 | | -</td> |
1360 | | -<td> |
1361 | | -<p>12 |
1362 | | -</p> |
| 1297 | +<td> 4 </td> |
| 1298 | +<td> 8 </td> |
| 1299 | +<td> 12 |
1363 | 1300 | </td></tr> |
1364 | 1301 | <tr> |
1365 | | -<th> |
1366 | | -<p>5 |
1367 | | -</p> |
| 1302 | +<th> 5 |
1368 | 1303 | </th> |
1369 | | -<td> |
1370 | | -<p>5 |
1371 | | -</p> |
1372 | | -</td> |
1373 | | -<td> |
1374 | | -<p>10 |
1375 | | -</p> |
1376 | | -</td> |
1377 | | -<td> |
1378 | | -<p>15 |
1379 | | -</p> |
| 1304 | +<td> 5 </td> |
| 1305 | +<td> 10 </td> |
| 1306 | +<td> 15 |
1380 | 1307 | </td></tr></table> |
1381 | 1308 | |
1382 | 1309 | !! end |
— | — | @@ -1394,26 +1321,16 @@ |
1395 | 1322 | !! result |
1396 | 1323 | <table align="right" border="1"> |
1397 | 1324 | <tr> |
1398 | | -<td> |
1399 | | -<p>Cell 1, row 1 |
1400 | | -</p> |
| 1325 | +<td> Cell 1, row 1 |
1401 | 1326 | </td> |
1402 | | -<td rowspan="2"> |
1403 | | -<p>Cell 2, row 1 (and 2) |
1404 | | -</p> |
| 1327 | +<td rowspan="2"> Cell 2, row 1 (and 2) |
1405 | 1328 | </td> |
1406 | | -<td> |
1407 | | -<p>Cell 3, row 1 |
1408 | | -</p> |
| 1329 | +<td> Cell 3, row 1 |
1409 | 1330 | </td></tr> |
1410 | 1331 | <tr> |
1411 | | -<td> |
1412 | | -<p>Cell 1, row 2 |
1413 | | -</p> |
| 1332 | +<td> Cell 1, row 2 |
1414 | 1333 | </td> |
1415 | | -<td> |
1416 | | -<p>Cell 3, row 2 |
1417 | | -</p> |
| 1334 | +<td> Cell 3, row 2 |
1418 | 1335 | </td></tr></table> |
1419 | 1336 | |
1420 | 1337 | !! end |
— | — | @@ -1434,26 +1351,18 @@ |
1435 | 1352 | !! result |
1436 | 1353 | <table border="1"> |
1437 | 1354 | <tr> |
1438 | | -<td> |
1439 | | -<p>α |
1440 | | -</p> |
| 1355 | +<td> α |
1441 | 1356 | </td> |
1442 | 1357 | <td> |
1443 | 1358 | <table bgcolor="#ABCDEF" border="2"> |
1444 | 1359 | <tr> |
1445 | | -<td> |
1446 | | -<p>nested |
1447 | | -</p> |
| 1360 | +<td>nested |
1448 | 1361 | </td></tr> |
1449 | 1362 | <tr> |
1450 | | -<td> |
1451 | | -<p>table |
1452 | | -</p> |
| 1363 | +<td>table |
1453 | 1364 | </td></tr></table> |
1454 | 1365 | </td> |
1455 | | -<td> |
1456 | | -<p>the original table again |
1457 | | -</p> |
| 1366 | +<td>the original table again |
1458 | 1367 | </td></tr></table> |
1459 | 1368 | |
1460 | 1369 | !! end |
— | — | @@ -1467,9 +1376,7 @@ |
1468 | 1377 | !! result |
1469 | 1378 | <table> |
1470 | 1379 | <tr> |
1471 | | -<td> |
1472 | | -<p>broken |
1473 | | -</p> |
| 1380 | +<td>broken |
1474 | 1381 | </td></tr></table> |
1475 | 1382 | |
1476 | 1383 | !! end |
— | — | @@ -1483,14 +1390,9 @@ |
1484 | 1391 | !! result |
1485 | 1392 | <table> |
1486 | 1393 | <tr> |
1487 | | -<td> |
1488 | | -<p>[<a href="ftp://%7Cx" class="external free" rel="nofollow">ftp://%7Cx</a> |
1489 | | -</p> |
| 1394 | +<td>[<a href="ftp://%7Cx" class="external free" rel="nofollow">ftp://%7Cx</a></td> |
| 1395 | +<td>]" onmouseover="alert(document.cookie)">test |
1490 | 1396 | </td> |
1491 | | -<td> |
1492 | | -<p>]" onmouseover="alert(document.cookie)">test |
1493 | | -</p> |
1494 | | -</td> |
1495 | 1397 | </tr> |
1496 | 1398 | </table> |
1497 | 1399 | |
— | — | @@ -2702,9 +2604,7 @@ |
2703 | 2605 | !! result |
2704 | 2606 | <table> |
2705 | 2607 | <tr> |
2706 | | -<td> |
2707 | | -<p>[[{{{1}}}|{{{2}}}]] |
2708 | | -</p> |
| 2608 | +<td>[[{{{1}}}|{{{2}}}]] |
2709 | 2609 | </td></tr></table> |
2710 | 2610 | |
2711 | 2611 | !! end |
— | — | @@ -2814,22 +2714,12 @@ |
2815 | 2715 | </p> |
2816 | 2716 | <table> |
2817 | 2717 | <tr> |
2818 | | -<td> |
2819 | | -<p>1 |
2820 | | -</p> |
2821 | | -</td> |
2822 | | -<td> |
2823 | | -<p>2 |
2824 | | -</p> |
| 2718 | +<td> 1 </td> |
| 2719 | +<td> 2 |
2825 | 2720 | </td></tr> |
2826 | 2721 | <tr> |
2827 | | -<td> |
2828 | | -<p>3 |
2829 | | -</p> |
2830 | | -</td> |
2831 | | -<td> |
2832 | | -<p>4 |
2833 | | -</p> |
| 2722 | +<td> 3 </td> |
| 2723 | +<td> 4 |
2834 | 2724 | </td></tr></table> |
2835 | 2725 | |
2836 | 2726 | !! end |
— | — | @@ -2844,22 +2734,12 @@ |
2845 | 2735 | </p> |
2846 | 2736 | <table> |
2847 | 2737 | <tr> |
2848 | | -<td> |
2849 | | -<p>1 |
2850 | | -</p> |
2851 | | -</td> |
2852 | | -<td> |
2853 | | -<p>2 |
2854 | | -</p> |
| 2738 | +<td> 1 </td> |
| 2739 | +<td> 2 |
2855 | 2740 | </td></tr> |
2856 | 2741 | <tr> |
2857 | | -<td> |
2858 | | -<p>3 |
2859 | | -</p> |
2860 | | -</td> |
2861 | | -<td> |
2862 | | -<p>4 |
2863 | | -</p> |
| 2742 | +<td> 3 </td> |
| 2743 | +<td> 4 |
2864 | 2744 | </td></tr></table> |
2865 | 2745 | |
2866 | 2746 | !! end |
— | — | @@ -4440,9 +4320,7 @@ |
4441 | 4321 | !! result |
4442 | 4322 | <table> |
4443 | 4323 | <tr> |
4444 | | -<th class="awesome"> |
4445 | | -<p>status |
4446 | | -</p> |
| 4324 | +<th class="awesome"> status |
4447 | 4325 | </th></tr></table> |
4448 | 4326 | |
4449 | 4327 | !!end |
— | — | @@ -4896,9 +4774,7 @@ |
4897 | 4775 | !! result |
4898 | 4776 | <table> |
4899 | 4777 | <tr> |
4900 | | -<th style="color:blue"> |
4901 | | -<p>status |
4902 | | -</p> |
| 4778 | +<th style="color:blue"> status |
4903 | 4779 | </th></tr></table> |
4904 | 4780 | |
4905 | 4781 | !!end |
— | — | @@ -4912,9 +4788,7 @@ |
4913 | 4789 | !! result |
4914 | 4790 | <table> |
4915 | 4791 | <tr> |
4916 | | -<th style="/* insecure input */"> |
4917 | | -<p>status |
4918 | | -</p> |
| 4792 | +<th style="/* insecure input */"> status |
4919 | 4793 | </th></tr></table> |
4920 | 4794 | |
4921 | 4795 | !! end |
— | — | @@ -5583,15 +5457,10 @@ |
5584 | 5458 | !! result |
5585 | 5459 | <table> |
5586 | 5460 | <tr> |
| 5461 | +<th>https://</th> |
| 5462 | +<th></th> |
| 5463 | +<th></th> |
5587 | 5464 | <th> |
5588 | | -<p>https:// |
5589 | | -</p> |
5590 | | -</th> |
5591 | | -<th> |
5592 | | -</th> |
5593 | | -<th> |
5594 | | -</th> |
5595 | | -<th> |
5596 | 5465 | </td> |
5597 | 5466 | </tr> |
5598 | 5467 | </table> |
— | — | @@ -5607,9 +5476,7 @@ |
5608 | 5477 | !! result |
5609 | 5478 | <table> |
5610 | 5479 | <tr> |
5611 | | -<th> |
5612 | | -<p><a href="irc://{{ftp://a" class="external free" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');" |
5613 | | -</p> |
| 5480 | +<th> <a href="irc://{{ftp://a" class="external free" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');" |
5614 | 5481 | </th> |
5615 | 5482 | <td> |
5616 | 5483 | </td> |
— | — | @@ -5655,9 +5522,7 @@ |
5656 | 5523 | |
5657 | 5524 | MOVE YOUR MOUSE CURSOR OVER THIS TEXT |
5658 | 5525 | <tr> |
5659 | | -<td> |
5660 | | -<p></u> |
5661 | | -</p> |
| 5526 | +<td></u> |
5662 | 5527 | </td> |
5663 | 5528 | </tr> |
5664 | 5529 | </table> |
— | — | @@ -7772,17 +7637,18 @@ |
7773 | 7638 | !!endarticle |
7774 | 7639 | |
7775 | 7640 | !! test |
7776 | | -Bug 529/12974: Uncovered bullet |
| 7641 | +Bug 529: Uncovered bullet |
7777 | 7642 | !! input |
7778 | 7643 | * Foo {{bullet}} |
7779 | 7644 | !! result |
7780 | | -<ul><li> Foo * Bar |
| 7645 | +<ul><li> Foo |
| 7646 | +</li><li> Bar |
7781 | 7647 | </li></ul> |
7782 | 7648 | |
7783 | 7649 | !! end |
7784 | 7650 | |
7785 | 7651 | !! test |
7786 | | -Bug 529/12974: Uncovered table already at line-start |
| 7652 | +Bug 529: Uncovered table already at line-start |
7787 | 7653 | !! input |
7788 | 7654 | x |
7789 | 7655 | |
— | — | @@ -7793,33 +7659,24 @@ |
7794 | 7660 | </p> |
7795 | 7661 | <table> |
7796 | 7662 | <tr> |
7797 | | -<td> |
7798 | | -<p>1 |
7799 | | -</p> |
7800 | | -</td> |
7801 | | -<td> |
7802 | | -<p>2 |
7803 | | -</p> |
| 7663 | +<td> 1 </td> |
| 7664 | +<td> 2 |
7804 | 7665 | </td></tr> |
7805 | 7666 | <tr> |
7806 | | -<td> |
7807 | | -<p>3 |
7808 | | -</p> |
7809 | | -</td> |
7810 | | -<td> |
7811 | | -<p>4 |
7812 | | -</p> |
| 7667 | +<td> 3 </td> |
| 7668 | +<td> 4 |
7813 | 7669 | </td></tr></table> |
7814 | 7670 | <p>y |
7815 | 7671 | </p> |
7816 | 7672 | !! end |
7817 | 7673 | |
7818 | 7674 | !! test |
7819 | | -Bug 529/12974: Uncovered bullet in parser function result |
| 7675 | +Bug 529: Uncovered bullet in parser function result |
7820 | 7676 | !! input |
7821 | 7677 | * Foo {{lc:{{bullet}} }} |
7822 | 7678 | !! result |
7823 | | -<ul><li> Foo * bar |
| 7679 | +<ul><li> Foo |
| 7680 | +</li><li> bar |
7824 | 7681 | </li></ul> |
7825 | 7682 | |
7826 | 7683 | !! end |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -814,22 +814,7 @@ |
815 | 815 | $has_opened_tr = array(); # Did this table open a <tr> element? |
816 | 816 | $indent_level = 0; # indent level of the table |
817 | 817 | |
818 | | - # Keep pulling lines off the front of the array until they're all gone. |
819 | | - # we want to be able to push lines back on to the front of the stream, |
820 | | - # but StringUtils::explode() returns funky optimised Iterators which don't |
821 | | - # support insertion. So maintain a separate buffer and draw on that first if |
822 | | - # there's anything in it |
823 | | - $extraLines = array(); |
824 | | - $lines->rewind(); |
825 | | - do { |
826 | | - if( $extraLines ){ |
827 | | - $outLine = array_shift( $extraLines ); |
828 | | - } elseif( $lines->valid() ) { |
829 | | - $outLine = $lines->current(); |
830 | | - $lines->next(); |
831 | | - } else { |
832 | | - break; |
833 | | - } |
| 818 | + foreach ( $lines as $outLine ) { |
834 | 819 | $line = trim( $outLine ); |
835 | 820 | |
836 | 821 | if ( $line === '' ) { # empty line, go to next line |
— | — | @@ -905,10 +890,11 @@ |
906 | 891 | } elseif ( $first_character === '|' || $first_character === '!' || substr( $line , 0 , 2 ) === '|+' ) { |
907 | 892 | # This might be cell elements, td, th or captions |
908 | 893 | if ( substr( $line , 0 , 2 ) === '|+' ) { |
909 | | - $first_character = '|+'; |
| 894 | + $first_character = '+'; |
| 895 | + $line = substr( $line , 1 ); |
910 | 896 | } |
911 | 897 | |
912 | | - $line = substr( $line , strlen( $first_character ) ); |
| 898 | + $line = substr( $line , 1 ); |
913 | 899 | |
914 | 900 | if ( $first_character === '!' ) { |
915 | 901 | $line = str_replace( '!!' , '||' , $line ); |
— | — | @@ -919,84 +905,62 @@ |
920 | 906 | # by earlier parser steps, but should avoid splitting up eg |
921 | 907 | # attribute values containing literal "||". |
922 | 908 | $cells = StringUtils::explodeMarkup( '||' , $line ); |
923 | | - $cell = array_shift( $cells ); |
924 | 909 | |
925 | | - # Inject cells back into the stream to be dealt with later |
926 | | - # TODO: really we should do the whole thing as a stream... |
927 | | - # but that would be too much like a sensible implementation :P |
928 | | - if( count( $cells ) ){ |
929 | | - foreach( array_reverse( $cells ) as $extraCell ){ |
930 | | - array_unshift( $extraLines, $first_character . $extraCell ); |
931 | | - } |
932 | | - } |
933 | | - |
934 | 910 | $outLine = ''; |
935 | 911 | |
936 | | - $previous = ''; |
937 | | - if ( $first_character !== '|+' ) { |
938 | | - $tr_after = array_pop( $tr_attributes ); |
939 | | - if ( !array_pop( $tr_history ) ) { |
940 | | - $previous = "<tr{$tr_after}>\n"; |
| 912 | + # Loop through each table cell |
| 913 | + foreach ( $cells as $cell ) { |
| 914 | + $previous = ''; |
| 915 | + if ( $first_character !== '+' ) { |
| 916 | + $tr_after = array_pop( $tr_attributes ); |
| 917 | + if ( !array_pop( $tr_history ) ) { |
| 918 | + $previous = "<tr{$tr_after}>\n"; |
| 919 | + } |
| 920 | + array_push( $tr_history , true ); |
| 921 | + array_push( $tr_attributes , '' ); |
| 922 | + array_pop( $has_opened_tr ); |
| 923 | + array_push( $has_opened_tr , true ); |
941 | 924 | } |
942 | | - array_push( $tr_history , true ); |
943 | | - array_push( $tr_attributes , '' ); |
944 | | - array_pop( $has_opened_tr ); |
945 | | - array_push( $has_opened_tr , true ); |
946 | | - } |
947 | 925 | |
948 | | - $last_tag = array_pop( $last_tag_history ); |
| 926 | + $last_tag = array_pop( $last_tag_history ); |
949 | 927 | |
950 | | - if ( array_pop( $td_history ) ) { |
951 | | - $previous = "</{$last_tag}>\n{$previous}"; |
952 | | - } |
| 928 | + if ( array_pop( $td_history ) ) { |
| 929 | + $previous = "</{$last_tag}>\n{$previous}"; |
| 930 | + } |
953 | 931 | |
954 | | - if ( $first_character === '|' ) { |
955 | | - $last_tag = 'td'; |
956 | | - } elseif ( $first_character === '!' ) { |
957 | | - $last_tag = 'th'; |
958 | | - } elseif ( $first_character === '|+' ) { |
959 | | - $last_tag = 'caption'; |
960 | | - } else { |
961 | | - $last_tag = ''; |
962 | | - } |
| 932 | + if ( $first_character === '|' ) { |
| 933 | + $last_tag = 'td'; |
| 934 | + } elseif ( $first_character === '!' ) { |
| 935 | + $last_tag = 'th'; |
| 936 | + } elseif ( $first_character === '+' ) { |
| 937 | + $last_tag = 'caption'; |
| 938 | + } else { |
| 939 | + $last_tag = ''; |
| 940 | + } |
963 | 941 | |
964 | | - array_push( $last_tag_history , $last_tag ); |
| 942 | + array_push( $last_tag_history , $last_tag ); |
965 | 943 | |
966 | | - # A cell could contain both parameters and data... but the pipe could |
967 | | - # also be the start of a nested table, or a raw pipe inside an invalid |
968 | | - # link (bug 553). |
969 | | - $cell_data = preg_split( '/(?<!\{)\|/', $cell, 2 ); |
| 944 | + # A cell could contain both parameters and data |
| 945 | + $cell_data = explode( '|' , $cell , 2 ); |
970 | 946 | |
971 | | - # Bug 553: a '|' inside an invalid link should not |
972 | | - # be mistaken as delimiting cell parameters |
973 | | - if ( strpos( $cell_data[0], '[[' ) !== false ) { |
974 | | - $data = $cell; |
975 | | - $cell = "{$previous}<{$last_tag}>"; |
976 | | - } elseif ( count( $cell_data ) == 1 ) { |
977 | | - $cell = "{$previous}<{$last_tag}>"; |
978 | | - $data = $cell_data[0]; |
979 | | - } else { |
980 | | - $attributes = $this->mStripState->unstripBoth( $cell_data[0] ); |
981 | | - $attributes = Sanitizer::fixTagAttributes( $attributes , $last_tag ); |
982 | | - $cell = "{$previous}<{$last_tag}{$attributes}>"; |
983 | | - $data = $cell_data[1]; |
984 | | - } |
| 947 | + # Bug 553: Note that a '|' inside an invalid link should not |
| 948 | + # be mistaken as delimiting cell parameters |
| 949 | + if ( strpos( $cell_data[0], '[[' ) !== false ) { |
| 950 | + $cell = "{$previous}<{$last_tag}>{$cell}"; |
| 951 | + } elseif ( count( $cell_data ) == 1 ) { |
| 952 | + $cell = "{$previous}<{$last_tag}>{$cell_data[0]}"; |
| 953 | + } else { |
| 954 | + $attributes = $this->mStripState->unstripBoth( $cell_data[0] ); |
| 955 | + $attributes = Sanitizer::fixTagAttributes( $attributes , $last_tag ); |
| 956 | + $cell = "{$previous}<{$last_tag}{$attributes}>{$cell_data[1]}"; |
| 957 | + } |
985 | 958 | |
986 | | - # Bug 529: the start of a table cell should be a linestart context for |
987 | | - # processing other block markup, including nested tables. The original |
988 | | - # implementation of this was to add a newline before every brace construct, |
989 | | - # which broke all manner of other things. Instead, push the contents |
990 | | - # of the cell back into the stream and come back to it later. But don't |
991 | | - # do that if the first line is empty, or you may get extra whitespace |
992 | | - if( $data ){ |
993 | | - array_unshift( $extraLines, trim( $data ) ); |
| 959 | + $outLine .= $cell; |
| 960 | + array_push( $td_history , true ); |
994 | 961 | } |
995 | | - |
996 | | - $outLine .= $cell; |
997 | | - array_push( $td_history , true ); |
998 | 962 | } |
999 | 963 | $out .= $outLine . "\n"; |
1000 | | - } while( $lines->valid() || count( $extraLines ) ); |
| 964 | + } |
1001 | 965 | |
1002 | 966 | # Closing open td, tr && table |
1003 | 967 | while ( count( $td_history ) > 0 ) { |
— | — | @@ -2260,7 +2224,6 @@ |
2261 | 2225 | '/(?:<\\/table|<\\/blockquote|<\\/h1|<\\/h2|<\\/h3|<\\/h4|<\\/h5|<\\/h6|'. |
2262 | 2226 | '<td|<th|<\\/?div|<hr|<\\/pre|<\\/p|'.$this->mUniqPrefix.'-pre|<\\/li|<\\/ul|<\\/ol|<\\/?center)/iS', $t ); |
2263 | 2227 | if ( $openmatch or $closematch ) { |
2264 | | - |
2265 | 2228 | $paragraphStack = false; |
2266 | 2229 | # TODO bug 5718: paragraph closed |
2267 | 2230 | $output .= $this->closeParagraph(); |
— | — | @@ -3251,11 +3214,11 @@ |
3252 | 3215 | $text = wfEscapeWikiText( $text ); |
3253 | 3216 | } elseif ( is_string( $text ) |
3254 | 3217 | && !$piece['lineStart'] |
3255 | | - && preg_match( '/^{\\|/', $text ) ) |
| 3218 | + && preg_match( '/^(?:{\\||:|;|#|\*)/', $text ) ) |
3256 | 3219 | { |
3257 | | - # Bug 529: if the template begins with a table, it should be treated as |
3258 | | - # beginning a new line. This previously handled other block-level elements |
3259 | | - # such as #, :, etc, but these have many false-positives (bug 12974). |
| 3220 | + # Bug 529: if the template begins with a table or block-level |
| 3221 | + # element, it should be treated as beginning a new line. |
| 3222 | + # This behaviour is somewhat controversial. |
3260 | 3223 | $text = "\n" . $text; |
3261 | 3224 | } |
3262 | 3225 | |
— | — | @@ -3314,7 +3277,7 @@ |
3315 | 3278 | |
3316 | 3279 | if ( !$title->equals( $cacheTitle ) ) { |
3317 | 3280 | $this->mTplRedirCache[$cacheTitle->getPrefixedDBkey()] = |
3318 | | - array( $title->getNamespace(), $title->getDBkey() ); |
| 3281 | + array( $title->getNamespace(), $cdb = $title->getDBkey() ); |
3319 | 3282 | } |
3320 | 3283 | |
3321 | 3284 | return array( $dom, $title ); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -91,11 +91,6 @@ |
92 | 92 | members. |
93 | 93 | * (bug 2585) Image pages should send 404 if no image, no shared image and no |
94 | 94 | description page. |
95 | | -* (bug 12974) The behaviour of wikitable and template parsing was altered. Previously, |
96 | | - all templates were treated as being at the start of a block context for the purposes |
97 | | - of evaluating wikitext elements like #, :, *, and tables (bug 529). Now this |
98 | | - behaviour is only applied to wikitable-start {|, but the first line of a wikitable |
99 | | - cell is now treated as a linestart. |
100 | 95 | * Custom editintro's using the editintro url parameter will no longer show <noinclude> |
101 | 96 | sections on pages they are included on. |
102 | 97 | * (bug 26449) Keep underlines from headings outside of tables and thumbs by |