r86013 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86012‎ | r86013 | r86014 >
Date:23:50, 13 April 2011
Author:platonides
Status:ok (Comments)
Tags:
Comment:
Move </td> and </th> to its own line (unless it's an empty cell)
Fixes the other r86004 test case and r86010 one.
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/tests/parser/parserTests.txt (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/parser/parserTests.txt
@@ -1255,12 +1255,16 @@
12561256 !! result
12571257 <table>
12581258 <tr>
1259 -<td>1</td>
1260 -<td>2</td>
 1259+<td>1
 1260+</td>
 1261+<td>2
 1262+</td>
12611263 </tr>
12621264 <tr>
1263 -<td>3</td>
1264 -<td>4</td>
 1265+<td>3
 1266+</td>
 1267+<td>4
 1268+</td>
12651269 </tr>
12661270 </table>
12671271
@@ -1295,41 +1299,65 @@
12961300 </caption>
12971301 <thead>
12981302 <tr>
1299 -<th>&#215;</th>
1300 -<th>1</th>
1301 -<th>2</th>
1302 -<th>3</th>
 1303+<th>&#215;
 1304+</th>
 1305+<th>1
 1306+</th>
 1307+<th>2
 1308+</th>
 1309+<th>3
 1310+</th>
13031311 </tr></thead>
13041312 <tbody>
13051313 <tr>
1306 -<th>1</th>
1307 -<td>1</td>
1308 -<td>2</td>
1309 -<td>3</td>
 1314+<th>1
 1315+</th>
 1316+<td>1
 1317+</td>
 1318+<td>2
 1319+</td>
 1320+<td>3
 1321+</td>
13101322 </tr>
13111323 <tr>
1312 -<th>2</th>
1313 -<td>2</td>
1314 -<td>4</td>
1315 -<td>6</td>
 1324+<th>2
 1325+</th>
 1326+<td>2
 1327+</td>
 1328+<td>4
 1329+</td>
 1330+<td>6
 1331+</td>
13161332 </tr>
13171333 <tr>
1318 -<th>3</th>
1319 -<td>3</td>
1320 -<td>6</td>
1321 -<td>9</td>
 1334+<th>3
 1335+</th>
 1336+<td>3
 1337+</td>
 1338+<td>6
 1339+</td>
 1340+<td>9
 1341+</td>
13221342 </tr>
13231343 <tr>
1324 -<th>4</th>
1325 -<td>4</td>
1326 -<td>8</td>
1327 -<td>12</td>
 1344+<th>4
 1345+</th>
 1346+<td>4
 1347+</td>
 1348+<td>8
 1349+</td>
 1350+<td>12
 1351+</td>
13281352 </tr>
13291353 <tr>
1330 -<th>5</th>
1331 -<td>5</td>
1332 -<td>10</td>
1333 -<td>15</td>
 1354+<th>5
 1355+</th>
 1356+<td>5
 1357+</td>
 1358+<td>10
 1359+</td>
 1360+<td>15
 1361+</td>
13341362 </tr></tbody>
13351363 </table>
13361364
@@ -1349,13 +1377,18 @@
13501378 !! result
13511379 <table align="right" border="1">
13521380 <tr>
1353 -<td>Cell 1, row 1</td>
1354 -<td rowspan="2">Cell 2, row 1 (and 2)</td>
1355 -<td>Cell 3, row 1</td>
 1381+<td>Cell 1, row 1
 1382+</td>
 1383+<td rowspan="2">Cell 2, row 1 (and 2)
 1384+</td>
 1385+<td>Cell 3, row 1
 1386+</td>
13561387 </tr>
13571388 <tr>
1358 -<td>Cell 1, row 2</td>
1359 -<td>Cell 3, row 2</td>
 1389+<td>Cell 1, row 2
 1390+</td>
 1391+<td>Cell 3, row 2
 1392+</td>
13601393 </tr>
13611394 </table>
13621395
@@ -1377,17 +1410,22 @@
13781411 !! result
13791412 <table border="1">
13801413 <tr>
1381 -<td>&#945;</td>
 1414+<td>&#945;
 1415+</td>
13821416 <td>
13831417 <table bgcolor="#ABCDEF" border="2">
13841418 <tr>
1385 -<td>nested</td>
 1419+<td>nested
 1420+</td>
13861421 </tr>
13871422 <tr>
1388 -<td>table</td>
 1423+<td>table
 1424+</td>
13891425 </tr>
1390 -</table></td>
1391 -<td>the original table again</td>
 1426+</table>
 1427+</td>
 1428+<td>the original table again
 1429+</td>
13921430 </tr>
13931431 </table>
13941432
@@ -1402,7 +1440,8 @@
14031441 !! result
14041442 <table>
14051443 <tr>
1406 -<td>broken</td>
 1444+<td>broken
 1445+</td>
14071446 </tr>
14081447 </table>
14091448
@@ -1439,7 +1478,8 @@
14401479 <caption><i>caption</i>
14411480 </caption>
14421481 <tr>
1443 -<td>Cell</td>
 1482+<td>Cell
 1483+</td>
14441484 </tr>
14451485 </table>
14461486
@@ -1454,7 +1494,8 @@
14551495 !! result
14561496 <table>
14571497 <tr>
1458 -<td><i>Cell</i></td>
 1498+<td><i>Cell</i>
 1499+</td>
14591500 </tr>
14601501 </table>
14611502
@@ -1471,8 +1512,10 @@
14721513 !! result
14731514 <table>
14741515 <tr>
1475 -<th><i>Cell</i></th>
1476 -<td>Value</td>
 1516+<th><i>Cell</i>
 1517+</th>
 1518+<td>Value
 1519+</td>
14771520 </tr>
14781521 </table>
14791522
@@ -1486,8 +1529,10 @@
14871530 !! result
14881531 <table>
14891532 <tr>
1490 -<td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
1491 -<td>]" onmouseover="alert(document.cookie)"&gt;test</td>
 1533+<td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a>
 1534+</td>
 1535+<td>]" onmouseover="alert(document.cookie)"&gt;test
 1536+</td>
14921537 </tr>
14931538 </table>
14941539
@@ -1504,12 +1549,16 @@
15051550 !! result
15061551 <dl><dd><table>
15071552 <tr>
1508 -<td>1</td>
1509 -<td>2</td>
 1553+<td>1
 1554+</td>
 1555+<td>2
 1556+</td>
15101557 </tr>
15111558 <tr>
1512 -<td>3</td>
1513 -<td>4</td>
 1559+<td>3
 1560+</td>
 1561+<td>4
 1562+</td>
15141563 </tr>
15151564 </table></dd></dl>
15161565
@@ -2773,7 +2822,8 @@
27742823 !! result
27752824 <table>
27762825 <tr>
2777 -<td>[[{{{1}}}|{{{2}}}]]</td>
 2826+<td>[[{{{1}}}|{{{2}}}]]
 2827+</td>
27782828 </tr>
27792829 </table>
27802830
@@ -2884,12 +2934,16 @@
28852935 </p>
28862936 <table>
28872937 <tr>
2888 -<td>1</td>
2889 -<td>2</td>
 2938+<td>1
 2939+</td>
 2940+<td>2
 2941+</td>
28902942 </tr>
28912943 <tr>
2892 -<td>3</td>
2893 -<td>4</td>
 2944+<td>3
 2945+</td>
 2946+<td>4
 2947+</td>
28942948 </tr>
28952949 </table>
28962950
@@ -2905,12 +2959,16 @@
29062960 </p>
29072961 <table>
29082962 <tr>
2909 -<td>1</td>
2910 -<td>2</td>
 2963+<td>1
 2964+</td>
 2965+<td>2
 2966+</td>
29112967 </tr>
29122968 <tr>
2913 -<td>3</td>
2914 -<td>4</td>
 2969+<td>3
 2970+</td>
 2971+<td>4
 2972+</td>
29152973 </tr>
29162974 </table>
29172975
@@ -4461,7 +4519,8 @@
44624520 !! result
44634521 <table>
44644522 <tr>
4465 -<th class="awesome">status</th>
 4523+<th class="awesome">status
 4524+</th>
44664525 </tr>
44674526 </table>
44684527
@@ -4907,7 +4966,8 @@
49084967 !! result
49094968 <table>
49104969 <tr>
4911 -<th style="color:blue">status</th>
 4970+<th style="color:blue">status
 4971+</th>
49124972 </tr>
49134973 </table>
49144974
@@ -4922,7 +4982,8 @@
49234983 !! result
49244984 <table>
49254985 <tr>
4926 -<th style="/* insecure input */">status</th>
 4986+<th style="/* insecure input */">status
 4987+</th>
49274988 </tr>
49284989 </table>
49294990
@@ -5577,7 +5638,8 @@
55785639 <h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span> <span class="mw-headline" id="a">a</span></h2>
55795640 <table style="&#95;_TOC&#95;_">
55805641 <tr>
5581 -<td>foo</td>
 5642+<td>foo
 5643+</td>
55825644 </tr>
55835645 </table>
55845646
@@ -5594,7 +5656,8 @@
55955657 !! result
55965658 <table>
55975659 <tr>
5598 -<th>https://</th>
 5660+<th>https://
 5661+</th>
55995662 <th></th>
56005663 <th></th>
56015664 <th></th>
@@ -5612,7 +5675,8 @@
56135676 !! result
56145677 <table>
56155678 <tr>
5616 -<th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"</th>
 5679+<th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
 5680+</th>
56175681 <td></td>
56185682 </tr>
56195683 </table>
@@ -5672,7 +5736,8 @@
56735737 </p>
56745738 <table>
56755739 <tr>
5676 -<td></u></td>
 5740+<td></u>
 5741+</td>
56775742 </tr>
56785743 </table>
56795744
@@ -7843,12 +7908,16 @@
78447909 </p>
78457910 <table>
78467911 <tr>
7847 -<td>1</td>
7848 -<td>2</td>
 7912+<td>1
 7913+</td>
 7914+<td>2
 7915+</td>
78497916 </tr>
78507917 <tr>
7851 -<td>3</td>
7852 -<td>4</td>
 7918+<td>3
 7919+</td>
 7920+<td>4
 7921+</td>
78537922 </tr></table>
78547923 <p>y
78557924 </p>
Index: trunk/phase3/includes/parser/Parser.php
@@ -1067,6 +1067,8 @@
10681068 $return .= '>';
10691069
10701070 $return .= $table[$i][$j]['content'];
 1071+ if ( $table[$i][$j]['content'] != '' )
 1072+ $return .= "\n";
10711073
10721074 $return .= '</' . $table[$i][$j]['type'] . '>';
10731075 unset( $table[$i][$j] );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86004Add a couple of broken tests showing why having the table closing tags in the...platonides23:16, 13 April 2011
r86010Another evil test to join r86004 (didn't produce malformed output in the pre-...platonides23:36, 13 April 2011

Comments

#Comment by Nikerabbit (talk | contribs)   07:41, 14 April 2011

Could you mention what and how it was wrong before you fixed it. From the diffs I only see expected output.

#Comment by Platonides (talk | contribs)   15:44, 14 April 2011

Mismatched tags: <td><i>Cell</td></i>

Status & tagging log