Jump to content

Extension:CategorySortHeaders

From mediawiki.org
This page is a translated version of the page Extension:CategorySortHeaders and the translation is 50% complete.
MediaWiki扩展手册
CategorySortHeaders
发行状态: 稳定版
实现 函数钩
描述 在分类页面中制作自定义标题,而不仅仅是第一个字符标题
作者
最新版本 0.4.0 (2021-04-20)
MediaWiki 1.35+
数据库更改
许可协议 GNU通用公眾授權條款2.0或更新版本
下載

  • $wgCategorySortHeaderAppendPageNameToKey
季度下載量 4 (Ranked 129th)
前往translatewiki.net翻譯CategorySortHeaders扩展

The CategorySortHeaders extension to allow specifying custom multi-character 'first-character' sorting headers to list pages under in categories, using syntax like [[Category:Foo|^Header^Invisible part of sortkey]] or even just [[Category:Foo|^Header^]].

用法

If you want a category to use a custom header, do [[Category:Cat name|^header^OptionalInvisibleSortkey]] (or {{DEFAULTSORT:^header^Optionalsortkey}}. If you want to use the default first letter headers, just use categories as normal.

安裝

  • 下载文件,并将解压后的CategorySortHeaders文件夹移动到extensions/目录中。
    开发者和代码贡献人员应从Git安装扩展,输入:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CategorySortHeaders
  • 将下列代码放置在您的LocalSettings.php 的底部:
    wfLoadExtension( 'CategorySortHeaders' );
    
  • Run either update.php or updateCollation.php from the command line (Note that running the web installer in upgrade mode does not work due to 工單T19335)
  • Yes 完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。

致使用MediaWiki 1.35或更早版本的用户:

上面的说明介绍的是安装此扩展的新方法,它使用wfLoadExtension()。 如果您需要在早期版本(MediaWiki 1.35和更早版本)中安装此扩展,而不是wfLoadExtension( 'CategorySortHeaders' );,您需要使用:

require_once "$IP/extensions/CategorySortHeaders/CategorySortHeaders.php";
警告 警告: Do not set $wgCategoryCollation in LocalSettings.php . This extension defines its own collation, and must use that.

配置

This extension has a single configuration option:

$wgCategorySortHeaderAppendPageNameToKey
It defaults to true, which causes a sortkey of ^foo^ to be treated like ^foo^{{PAGENAME}}. If it is set to false, it will sort ^foo^ above ^foo^<any string here>. (In both cases, if there are two exactly same sort keys, the pagename will be used as a tie breaker.) After changing this option you should run:
php updateCollation.php --force
If anyone likes the idea of this extension, but wants to use the uca-default collation instead of uppercase - let me (bawolff) know. It probably wouldn't be very difficult to modify this extension to make it work with uca-default

參見