Manual:ウィキ マークアップの拡張
MediaWiki は簡単にカスタマイズできる標準的なテキスト マークアップを提供します。 Extensions can customize wiki markup by:
- 標準的なトークン タイプを追加する: MediaWiki のマークアップをカスタマイズする標準的な方法は組み込みのMediaWiki のXML タグ (
<タグ>
) や テンプレート ({{...}}
)、またはリンク マークアップの([[...]]
)のような新しいマークアップを追加することです。 - カスタム トークン タイプを追加する: 拡張機能の中には新しいトークン タイプを定義するものがあります。
- パーサーへの根本的な変更: わずかな拡張機能が、標準的なウィキ マークアップの代わりに他のマークアップ言語を使用できるように、構文解析戦略を根本的に変更することを試みています。
標準的なトークン タイプに追加する
The simplest way to extend wiki markup is by adding to a standard token type using one of these features.
変数
A variable calls a PHP function that outputs a string of ウィキテキスト that replaces the variable on the page. それらは通常システム情報をウィキ マークアップに差し込むために使用されます (例: 現在の日時、現在のページ)。
Syntax example:
{{VARIABLENAME}}
To define a variable, see Manual:Variables . For a list of extensions that define custom variables, see カテゴリ:変数の拡張機能 .
Parser functions
Like variables, a parser function calls a PHP function and outputs a wikitext string that replaces the parser function on the page. Unlike variables, a parser function can pass parameters to the PHP function. パーサー関数は、通常のテンプレート記述テクニックを使用するには複雑過ぎるまたは混乱を招くロジックを含むウィキテキスト生成を取り扱うために使用されます。
Syntax example:
{{#functionname: param1 | param2}}
To define a parser function, see Manual:パーサー関数 . For a list of extensions that define custom parser functions, see カテゴリ:パーサー関数の拡張機能 .
Parser tags
Unlike variables and parser functions, which output wikitext, parser tags output HTML.
A parser tag is an XML tag that calls a PHP function, parses the contents of the tag, and outputs HTML that replaces the tag and its contents on the page.
Parser tags can also pass arguments to the PHP function.
For example, <syntaxhighlight>
is a parser tag defined by Extension:SyntaxHighlight .
Syntax example:
<tagnameparam1name="param1value"param2name="param2value">sometext</tagname>
To define a parser tag, see Manual:タグ拡張機能 . For a list of extensions that define custom parser tags, see カテゴリ:タグ拡張機能 .
Behavior switches
A behavior switch calls a PHP function, but, unlike other methods of extending wiki markup, behavior switches usually do not output any content.
Instead, they change the behavior of the page or set a page property.
For example, adding __NOTOC__
to a page hides the table of contents.
Syntax example:
__SWITCHNAME__
To define a behavior switch, see Manual:マジックワード . For a list of extensions that define custom behavior switches, see Help:マジックワード .
Link markup
Link markup customizations change the way MediaWiki interprets internal links.
Syntax example:
[[ ... ]]
For a list of extensions that define custom link markup, see カテゴリ:リンクマークアップの拡張機能 .
新しいトークン タイプを追加する
新しいトークン タイプを追加するまたは全体のマークアップ戦略を変更するには、実装者はさまざまなパーサーとページ出力フックのうちの1つ以上に関数を追加する必要があります:
- Category:ParserBeforeStrip extensions は ParserBeforeStrip フックに依存しています。 (1.36 で除去)
- Category:ParserBeforeInternalParse extensions は ParserBeforeInternalParse フックに依存しています。
- Category:OutputPageBeforeHTML extensions は OutputPageBeforeHTML フックに依存しています。
- Category:ParserAfterTidy extensions は ParserAfterTidy フックに依存しています。
See also カテゴリ:Extensions by hook usage .
関連項目
- Manual:拡張機能 - 拡張機能の探し方、インストール、書き方についての一般的な手引きを提供します。