Extension:CategoryTests/ja

From mediawiki.org
This page is a translated version of the page Extension:CategoryTests and the translation is 33% complete.
MediaWiki 拡張機能マニュアル
Category Tests
リリースの状態: 安定
実装 パーサー関数
説明 カテゴリをチェックする一連のパーサー関数を提供する
作者 Ryan Schmidt (Skizzerzトーク)
最新バージョン 1.6.0 (2017-10-28)
MediaWiki 1.32+
PHP 5.3+
ライセンス GNU 一般公衆利用許諾書 2.0 以降
ダウンロード
Quarterly downloads 3 (Ranked 146th)
translatewiki.net で翻訳を利用できる場合は、CategoryTests 拡張機能の翻訳にご協力ください

The CategoryTests extension provides a set of dynamic parser functions that check for categories.

使用法

現在、カテゴリ テスト用に3つのパーサー関数を定義しています。

  • {{#ifcategory:category|then|else|page}}
Tests if the given page is in the category given, then displays "then" or "else" (or current page if no page is given).
  • {{#ifnocategories:then|else|page}}
Tests if the given page does not belong in any categories, then displays "then" or "else" (or current page if no page is given).
  • {{#switchcategory:category1=result1|category2=result2|...|default}}
Operates like the ParserFunctions #switch , but doesn't take an initial parameter (it just starts cycling through right away) and tests if the page is in those categories instead of comparing it to a value. You can specify to test other pages using #page=pagename, where it would then test that page instead of the current page until the next #page definition, in which case it will test that page now instead. Making #page empty resets it to the current page. If your default case needs an equals sign, you may use #default to declare it.

インストール

  • ダウンロードして、ファイルをextensions/フォルダー内のCategoryTestsという名前のディレクトリ内に配置します。
    開発者とコード寄稿者は、上記の代わりに以下を使用してGitからインストールします:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTests
  • 以下のコードを LocalSettings.php ファイルの末尾に追加します:
    wfLoadExtension( 'CategoryTests' );
    
  • Yes 完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。

関連項目

  • ParserFunctions - For more general conditional constructs
  • PageInCat - The main difference seems to be that PageInCat will always try to use categories from the current revision, while CategoryTests may sometimes use the categories from the previous revision, which could result in unexpected page content