手册:$wgFragmentMode

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Manual:$wgFragmentMode and the translation is 5% complete.

Other languages:
English • ‎polski • ‎中文 • ‎日本語
解析器: $wgFragmentMode
Determines how section IDs should be encoded
引进版本:1.30.0 (Gerrit change 362326; git #Id304010)
移除版本:仍在使用
允许的值:(array)
默认值:[ 'legacy', 'html5' ] (1.31-)
[ 'legacy' ] (1.30)
其他设置: 按首字母排序 | 按功能排序

Determines how section IDs should be encoded.

Details

This array can contain 1 or 2 elements, each of them can be one of:

  • 'html5' - modern HTML5 style encoding with minimal escaping. Allows to display Unicode characters in many browsers' address bars.
  • 'legacy' - old MediaWiki-style encoding, e.g. 啤酒 turns into .E5.95.A4.E9.85.92.
  • 'html5-legacy' corresponds to the 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 a page.

The optional second element defines a fallback mode, useful for migrations. If present, it will direct MediaWiki to add empty <span> to every section with its id attribute set to fallback encoded title so that links using the previous encoding would still work.

Example: you want to migrate your wiki from 'legacy' to 'html5'. On the first step, set this variable to [ 'legacy', 'html5' ]. After a while, when all caches (parser, HTTP, etc.) contain only pages generated with this setting, flip the value to [ 'html5', 'legacy' ]. This will result in all internal links being generated in the new encoding while old links (both external and cached internal) will still work. After a long time, you might want to ditch backwards compatibility and set it to [ 'html5' ]. After all, pages get edited, breaking incoming links no matter which fragment mode is used.

See also