Extension:Disambiguator/zh

This page is a translated version of the page Extension:Disambiguator and the translation is 14% complete.
Other languages:
English • ‎Türkçe • ‎dansk • ‎español • ‎français • ‎slovenčina • ‎فارسی • ‎हिन्दी • ‎中文 • ‎日本語
MediaWiki擴充功能手冊
OOjs UI icon advanced-invert.svg
Disambiguator
发布状态: 稳定版
实现 特殊页面
描述 Enables the designation of disambiguation pages with a magic word
作者 Ryan Kaldari (Kaldari讨论)
最新版本 持续更新
兼容性方针 Snapshots releases along with MediaWiki. Master is not backward compatible.
MediaWiki 1.28+
PHP 5.4+
许可协议 MIT授權條款
下载

  • $wgDisambiguatorIndicateLinks
翻譯Disambiguator擴充功能如在translatewiki.net可用

检查使用和版本矩阵。

问题 尚未完成的工作 · 回報錯誤

The Disambiguator extension is designed to make disambiguation pages easier to work with programmatically. It allows you to designate all disambiguation pages with the __DISAMBIG__ magic word (or an equivalent alias), which then marks them as such in the database. This allows other extensions to optionally handle disambiguation pages as a separate class of page, although they are still considered "normal" pages.

安装

  • 下载文件,并将其放置在您extensions/文件夹中的Disambiguator目录内。
  • 将下列代码放置在您的LocalSettings.php的底部:
    wfLoadExtension( 'Disambiguator' );
    
  • 根据需要配置。
  •   完成 – 在您的wiki上导航至Special:Version,以验证扩展已成功安装。

配置

The following configuration variables can be set from your LocalSettings.php file.

  • $wgDisambiguatorIndicateLinks - whether to add a 'mw-disambig' CSS class to links to disambiguation pages (default is true)

功能

Disambiguator provides the following features:

  • Programmatic identification of disambiguation pages via the __DISAMBIG__ magic word
  • New special pages for listing all disambiguation pages and pages linking to disambiguation pages
  • New API functions equivalent to the above special pages as well as an API function for querying whether or not a page is a disambiguation page
  • Modifies Special:LonelyPages to ignore disambiguation pages
  • Modifies Special:Random to ignore disambiguation pages (requires MediaWiki 1.26.0)
  • If VisualEditor is enabled, allows marking a page as a disambiguation page via the page properties interface
  • If VisualEditor is enabled, shows whether a page is a disambiguation page or not in the link inspector
  • If VisualEditor is enabled, shows whether a page is a disambiguation page or not in the link dialog
  • If configured, adds a 'mw-disambig' CSS class to links to disambiguation pages (See #Configuration above)

用法

On wiki

Once Disambiguator is installed, the best way to use it is to add the __DISAMBIG__ magic word to a template that is then included in all of your disambiguation pages.

Once the magic word is in place, your disambiguation pages will all have the 'disambiguation' page property assigned to them in the database. This property resides in the page_props table.

You will also have two new 特殊页面 :

  • Special:DisambiguationPages - which lists all the disambiguation pages on your wiki.
  • Special:DisambiguationPageLinks - which lists all of the pages on your wiki that link to disambiguation pages. (This is a replacement for the old Special:Disambiguations page which is deprecated.)

With API

To list all the disambiguation pages:

api.php?action=query&list=querypage&qppage=DisambiguationPages

To list all the disambiguation page links:

api.php?action=query&list=querypage&qppage=DisambiguationPageLinks

Note that on wikis running in MiserMode (all WMF wikis), both the special page and API interface for DisambiguationPageLinks are limited to a certain number of results (typically 1000–5000).

To see if an individual page is a disambiguation page:

api.php?action=query&titles=Bug&prop=pageprops&ppprop=disambiguation

If it is a disambiguation page it will include 'disambiguation' in its pageprops. Note that the disambiguation pageprop, if present, will have its value set to an empty string, so be careful about testing it as a boolean.

Possible future plans

  • Add an option to hide disambiguation pages from:

Special:AllPages (task #9936), Special:PrefixIndex (task #11319), Special:WhatLinksHere (task #9935), Special:AncientPages (task #76287)

  • Consider extending link dialog in wikitext editor with ability to detect disambigs in search results and pull a list of links