* The $wgSiteSupportPage setting, unused since 1.5, was removed.
* $wgJpegQuality was added to allow configuring the quality of JPEG thumbnails (default 80).
* The default quality of JPEG thumbnails generated by GD was reduced from 95 to 80.
+* $wgExperimentalHtmlIds, deprecated since 1.30, has been removed. The 'html5-legacy' value for
+ $wgFragmentMode is no longer accepted.
* …
=== New features in 1.32 ===
*/
$wgDisableOutputCompression = false;
-/**
- * Abandoned experiment with HTML5-style ID escaping. Normalized IDs a bit
- * too aggressively, breaking preexisting content (particularly Cite).
- * See T29733, T29694, T29474.
- *
- * @deprecated since 1.30, use $wgFragmentMode
- */
-$wgExperimentalHtmlIds = false;
-
/**
* How should section IDs be encoded?
* This array can contain 1 or 2 elements, each of them can be one of:
* - 'html5' is modern HTML5 style encoding with minimal escaping. Displays Unicode
* characters in most browsers' address bars.
* - 'legacy' is old MediaWiki-style encoding, e.g. 啤酒 turns into .E5.95.A4.E9.85.92
- * - 'html5-legacy' corresponds to DEPRECATED $wgExperimentalHtmlIds mode. DO NOT use
- * it for anything but migration off that mode (see below).
*
* The first element of this array specifies the primary mode of escaping IDs. This
* is what users will see when they e.g. follow an [[#internal link]] to a section of
}
unset( $repo ); // no global pollution; destroy reference
-// Convert this deprecated setting to modern system
-if ( $wgExperimentalHtmlIds ) {
- wfDeprecated( '$wgExperimentalHtmlIds', '1.30' );
- $wgFragmentMode = [ 'html5-legacy', 'html5' ];
-}
-
$rcMaxAgeDays = $wgRCMaxAge / ( 3600 * 24 );
if ( $wgRCFilterByAge ) {
// Trim down $wgRCLinkDays so that it only lists links which are valid
/**
* Given a value, escape it so that it can be used in an id attribute and
- * return it. This will use HTML5 validation if $wgExperimentalHtmlIds is
- * true, allowing anything but ASCII whitespace. Otherwise it will use
- * HTML 4 rules, which means a narrow subset of ASCII, with bad characters
- * escaped with lots of dots.
+ * return it. This will use HTML5 validation, allowing anything but ASCII
+ * whitespace.
+ *
+ * To ensure we don't have to bother escaping anything, we also strip ', ".
+ * TODO: Is this the best tactic?
*
- * To ensure we don't have to bother escaping anything, we also strip ', ",
- * & even if $wgExperimentalIds is true. TODO: Is this the best tactic?
* We also strip # because it upsets IE, and % because it could be
* ambiguous if it's part of something that looks like a percent escape
* (which don't work reliably in fragments cross-browser).
* @param string|array $options String or array of strings (default is array()):
* 'noninitial': This is a non-initial fragment of an id, not a full id,
* so don't pay attention if the first character isn't valid at the
- * beginning of an id. Only matters if $wgExperimentalHtmlIds is
- * false.
- * 'legacy': Behave the way the old HTML 4-based ID escaping worked even
- * if $wgExperimentalHtmlIds is used, so we can generate extra
- * anchors and links won't break.
+ * beginning of an id.
* @return string
*/
static function escapeId( $id, $options = [] ) {
- global $wgExperimentalHtmlIds;
$options = (array)$options;
- if ( $wgExperimentalHtmlIds && !in_array( 'legacy', $options ) ) {
- $id = preg_replace( '/[ \t\n\r\f_\'"&#%]+/', '_', $id );
- $id = trim( $id, '_' );
- if ( $id === '' ) {
- // Must have been all whitespace to start with.
- return '_';
- } else {
- return $id;
- }
- }
-
// HTML4-style escaping
static $replace = [
'%3A' => ':',
$id = urlencode( str_replace( ' ', '_', $id ) );
$id = strtr( $id, $replace );
break;
- case 'html5-legacy':
- $id = preg_replace( '/[ \t\n\r\f_\'"&#%]+/', '_', $id );
- $id = trim( $id, '_' );
- if ( $id === '' ) {
- // Must have been all whitespace to start with.
- $id = '_';
- }
- break;
default:
throw new InvalidArgumentException( "Invalid mode '$mode' passed to '" . __METHOD__ );
}
switch ( mode ) {
case 'html5':
return str.replace( / /g, '_' );
- case 'html5-legacy':
- str = str.replace( /[ \t\n\r\f_'"&#%]+/g, '_' )
- .replace( /^_+|_+$/, '' );
- if ( str === '' ) {
- str = '_';
- }
- return str;
case 'legacy':
return rawurlencode( str.replace( / /g, '_' ) )
.replace( /%3A/g, ':' )
$setup['wgNoFollowLinks'] = true;
$setup['wgNoFollowDomainExceptions'] = [ 'no-nofollow.org' ];
$setup['wgExternalLinkTarget'] = false;
- $setup['wgExperimentalHtmlIds'] = false;
$setup['wgLocaltimezone'] = 'UTC';
$setup['wgHtml5'] = true;
$setup['wgDisableLangConversion'] = false;
$legacyEncoded = 'foo_.D1.82.D0.B5.D1.81.D1.82_.23.25.21.27.28.29.5B.5D:.3C.3E' .
'.26.26amp.3B.26amp.3Bamp.3B';
$html5Encoded = 'foo_тест_#%!\'()[]:<>&&&amp;';
- $html5Experimental = 'foo_тест_!_()[]:<>_amp;_amp;amp;';
// Settings: last element is $wgExternalInterwikiFragmentMode, the rest is $wgFragmentMode
$legacy = [ 'legacy', 'legacy' ];
$newLegacy = [ 'html5', 'legacy', 'legacy' ];
$new = [ 'html5', 'legacy' ];
$allNew = [ 'html5', 'html5' ];
- $experimentalLegacy = [ 'html5-legacy', 'legacy', 'legacy' ];
- $newExperimental = [ 'html5', 'html5-legacy', 'legacy' ];
return [
// Pure legacy: how MW worked before 2017
[ 'Attribute', $allNew, $text, false, Sanitizer::ID_FALLBACK ],
[ 'Link', $allNew, $text, $html5Encoded ],
[ 'ExternalInterwiki', $allNew, $text, $html5Encoded ],
-
- // Someone flipped $wgExperimentalHtmlIds on
- [ 'Attribute', $experimentalLegacy, $text, $html5Experimental, Sanitizer::ID_PRIMARY ],
- [ 'Attribute', $experimentalLegacy, $text, $legacyEncoded, Sanitizer::ID_FALLBACK ],
- [ 'Link', $experimentalLegacy, $text, $html5Experimental ],
- [ 'ExternalInterwiki', $experimentalLegacy, $text, $legacyEncoded ],
-
- // Migration from $wgExperimentalHtmlIds to modern HTML5
- [ 'Attribute', $newExperimental, $text, $html5Encoded, Sanitizer::ID_PRIMARY ],
- [ 'Attribute', $newExperimental, $text, $html5Experimental, Sanitizer::ID_FALLBACK ],
- [ 'Link', $newExperimental, $text, $html5Encoded ],
- [ 'ExternalInterwiki', $newExperimental, $text, $legacyEncoded ],
];
}
var text = 'foo тест_#%!\'()[]:<>',
legacyEncoded = 'foo_.D1.82.D0.B5.D1.81.D1.82_.23.25.21.27.28.29.5B.5D:.3C.3E',
html5Encoded = 'foo_тест_#%!\'()[]:<>',
- html5Experimental = 'foo_тест_!_()[]:<>',
// Settings: this is $wgFragmentMode
legacy = [ 'legacy' ],
legacyNew = [ 'legacy', 'html5' ],
newLegacy = [ 'html5', 'legacy' ],
- allNew = [ 'html5' ],
- experimentalLegacy = [ 'html5-legacy', 'legacy' ],
- newExperimental = [ 'html5', 'html5-legacy' ];
+ allNew = [ 'html5' ];
// Test cases are kept in sync with SanitizerTest.php
[
// New world: HTML5 links, legacy fallbacks
[ newLegacy, text, html5Encoded ],
// Distant future: no legacy fallbacks
- [ allNew, text, html5Encoded ],
- // Someone flipped $wgExperimentalHtmlIds on
- [ experimentalLegacy, text, html5Experimental ],
- // Migration from $wgExperimentalHtmlIds to modern HTML5
- [ newExperimental, text, html5Encoded ]
+ [ allNew, text, html5Encoded ]
].forEach( function ( testCase ) {
mw.config.set( 'wgFragmentMode', testCase[ 0 ] );
var text = 'foo тест_#%!\'()[]:<>',
legacyEncoded = 'foo_.D1.82.D0.B5.D1.81.D1.82_.23.25.21.27.28.29.5B.5D:.3C.3E',
html5Encoded = 'foo_тест_#%!\'()[]:<>',
- html5Experimental = 'foo_тест_!_()[]:<>',
// Settings: this is wgFragmentMode
legacy = [ 'legacy' ],
legacyNew = [ 'legacy', 'html5' ],
newLegacy = [ 'html5', 'legacy' ],
- allNew = [ 'html5' ],
- experimentalLegacy = [ 'html5-legacy', 'legacy' ],
- newExperimental = [ 'html5', 'html5-legacy' ];
+ allNew = [ 'html5' ];
[
// Pure legacy: how MW worked before 2017
// New world: HTML5 links, legacy fallbacks
[ newLegacy, text, html5Encoded ],
// Distant future: no legacy fallbacks
- [ allNew, text, html5Encoded ],
- // Someone flipped wgExperimentalHtmlIds on
- [ experimentalLegacy, text, html5Experimental ],
- // Migration from wgExperimentalHtmlIds to modern HTML5
- [ newExperimental, text, html5Encoded ]
+ [ allNew, text, html5Encoded ]
].forEach( function ( testCase ) {
mw.config.set( 'wgFragmentMode', testCase[ 0 ] );