Extension:Disambiguator
Disambiguator 发行状态: 稳定版 |
|
---|---|
实现 | 特殊页面 |
描述 | 使用魔术字启用消除歧义页 |
作者 | Ryan Kaldari (Kaldari留言) |
最新版本 | 持续更新 |
兼容性政策 | 快照跟随MediaWiki发布。 master分支不向后兼容。 |
MediaWiki | 1.28+ |
PHP | 5.4+ |
许可协议 | MIT授權條款 |
下載 | |
帮助 | Help:Extension:Disambiguator/zh |
|
|
季度下載量 | 51 (Ranked 84th) |
正在使用的公开wiki数 | 6,730 (Ranked 31st) |
前往translatewiki.net翻譯Disambiguator扩展 | |
問題 | 开启的任务 · 报告错误 |
这个消歧义扩展被设计以用于更方便地以编程方式处理消歧义页。
它允许你使用 __DISAMBIG__
magic word (或一个等价的别名)来标记所有的消歧义页,然后将它们标记在数据库中。
这允许其他扩展可选地将消除歧义页作为一个单独的页类来处理,尽管它们仍然被认为是“正常”页。
安裝
- 下载文件,并将解压后的
Disambiguator
文件夹移动到extensions/
目录中。
开发者和代码贡献人员应从Git安装扩展,输入:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Disambiguator - 将下列代码放置在您的LocalSettings.php 的底部:
wfLoadExtension( 'Disambiguator' );
- 按需求配置。
- 完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。
配置
下面的各变量可以在你的 LocalSettings.php 文件中进行设置。
- $wgDisambiguatorIndicateLinks - whether to add a 'mw-disambig' CSS class to links to disambiguation pages (default is true)
- $wgDisambiguatorNotifications - whether to warn the user when they type a link to a disambiguation page in wikitext editors (default is false)
功能
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)
- Warns a WikiEditor user when linking to a disambiguation page, and allows them to fix the link.
用法
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.
SQL
To see if an individual page is a disambiguation page, check the page_props
table for the presence of a pp_propname = 'disambiguation'
.
Pages that are not disambiguation pages will not have this pp_propname
.
The pp_value
isn't important.
SELECT page_title, pp_propname
FROM page
LEFT JOIN page_props ON pp_page = page_id AND pp_propname = 'disambiguation'
WHERE page_namespace = 0
AND page_title IN ('John', 'COVID-19') -- John is a disambiguation page on enwiki, COVID-19 is not
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
此扩展用于一个或多个维基媒体项目。 这可能意味着扩展足够稳定、运作足够良好,可以用在这样的高流量的网站上。 请在维基媒体的CommonSettings.php和InitialiseSettings.php配置文件中查找此扩展的名称以查看哪些网站安装了该扩展。 特定wiki上的已安装的扩展的完整列表位于Special:Version页面。 |
此扩展在以下wiki农场/托管网站和/或软件包中提供: 這不是一份權威名單。 即使某些wiki农场/托管网站和/或软件包未在这里列出,它们也可能提供此扩展。 请检查你的wiki农场/托管网站或软件包以确认提供情况。 |
- Stable extensions/zh
- Special page extensions/zh
- MIT licensed extensions/zh
- Extensions in Wikimedia version control/zh
- AncientPagesQuery extensions/zh
- ChangeTagsListActive extensions/zh
- EditPage::showEditForm:initial extensions/zh
- GetDoubleUnderscoreIDs extensions/zh
- GetLinkColours extensions/zh
- LinksUpdateComplete extensions/zh
- ListDefinedTags extensions/zh
- LonelyPagesQuery extensions/zh
- RandomPageQuery extensions/zh
- RecentChange save extensions/zh
- ShortPagesQuery extensions/zh
- WgQueryPages extensions/zh
- All extensions/zh
- Extensions used on Wikimedia/zh
- Extensions included in Canasta/zh
- Extensions included in Fandom/zh
- Extensions included in Miraheze/zh
- Extensions included in MyWikis/zh
- Extensions included in wiki.gg/zh
- Extensions included in WikiForge/zh
- Disambiguation extensions/zh