Index: trunk/phase3/HISTORY |
— | — | @@ -455,6 +455,7 @@ |
456 | 456 | * (bug 20244) Installer does not validate SQLite database directory for stable path |
457 | 457 | * (bug 1379) Installer directory conflicts with some hosts' configuration panel. |
458 | 458 | * (bug 12070) After Installation MySQL was blocked |
| 459 | +* Fix XML well-formedness on a few pages when $wgHtml5 is true (the default) |
459 | 460 | |
460 | 461 | === API changes in 1.17 === |
461 | 462 | * (bug 22738) Allow filtering by action type on query=logevent. |
Index: trunk/phase3/tests/parser/parserTests.txt |
— | — | @@ -1264,7 +1264,7 @@ |
1265 | 1265 | <caption>Multiplication table |
1266 | 1266 | </caption> |
1267 | 1267 | <tr> |
1268 | | -<th> × </th> |
| 1268 | +<th> × </th> |
1269 | 1269 | <th> 1 </th> |
1270 | 1270 | <th> 2 </th> |
1271 | 1271 | <th> 3 |
— | — | @@ -1351,7 +1351,7 @@ |
1352 | 1352 | !! result |
1353 | 1353 | <table border="1"> |
1354 | 1354 | <tr> |
1355 | | -<td> α |
| 1355 | +<td> α |
1356 | 1356 | </td> |
1357 | 1357 | <td> |
1358 | 1358 | <table bgcolor="#ABCDEF" border="2"> |
— | — | @@ -1730,7 +1730,7 @@ |
1731 | 1731 | !! input |
1732 | 1732 | [[ Main Page ]] |
1733 | 1733 | !! result |
1734 | | -<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page"> Main Page </a> |
| 1734 | +<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">  Main   Page  </a> |
1735 | 1735 | </p> |
1736 | 1736 | !!end |
1737 | 1737 | |
Index: trunk/phase3/includes/Sanitizer.php |
— | — | @@ -1093,7 +1093,8 @@ |
1094 | 1094 | * for XML and XHTML specifically. Any stray bits will be |
1095 | 1095 | * &-escaped to result in a valid text fragment. |
1096 | 1096 | * |
1097 | | - * a. any named char refs must be known in XHTML |
| 1097 | + * a. named char refs can only be < > & ", others are |
| 1098 | + * numericized (this way we're well-formed even without a DTD) |
1098 | 1099 | * b. any numeric char refs must be legal chars, not invalid or forbidden |
1099 | 1100 | * c. use &#x, not &#X |
1100 | 1101 | * d. fix or reject non-valid attributes |
— | — | @@ -1130,9 +1131,10 @@ |
1131 | 1132 | |
1132 | 1133 | /** |
1133 | 1134 | * If the named entity is defined in the HTML 4.0/XHTML 1.0 DTD, |
1134 | | - * return the named entity reference as is. If the entity is a |
1135 | | - * MediaWiki-specific alias, returns the HTML equivalent. Otherwise, |
1136 | | - * returns HTML-escaped text of pseudo-entity source (eg &foo;) |
| 1135 | + * return the equivalent numeric entity reference (except for the core < |
| 1136 | + * > & "). If the entity is a MediaWiki-specific alias, returns |
| 1137 | + * the HTML equivalent. Otherwise, returns HTML-escaped text of |
| 1138 | + * pseudo-entity source (eg &foo;) |
1137 | 1139 | * |
1138 | 1140 | * @param $name String |
1139 | 1141 | * @return String |
— | — | @@ -1141,8 +1143,11 @@ |
1142 | 1144 | global $wgHtmlEntities, $wgHtmlEntityAliases; |
1143 | 1145 | if ( isset( $wgHtmlEntityAliases[$name] ) ) { |
1144 | 1146 | return "&{$wgHtmlEntityAliases[$name]};"; |
1145 | | - } elseif( isset( $wgHtmlEntities[$name] ) ) { |
| 1147 | + } elseif ( in_array( $name, |
| 1148 | + array( 'lt', 'gt', 'amp', 'quot' ) ) ) { |
1146 | 1149 | return "&$name;"; |
| 1150 | + } elseif ( isset( $wgHtmlEntities[$name] ) ) { |
| 1151 | + return "&#{$wgHtmlEntities[$name]};"; |
1147 | 1152 | } else { |
1148 | 1153 | return "&$name;"; |
1149 | 1154 | } |