Manual:フック/ParserBeforeStrip

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Manual:Hooks/ParserBeforeStrip and the translation is 30% complete.

Other languages:
English • ‎español • ‎čeština • ‎日本語
ParserBeforeStrip
version 1.5.0 から利用可能
Used to process the raw wiki code before any internal processing is applied
関数の定義:
public static function onParserBeforeStrip( &$parser, &$text, &$strip_state ) { ... }
フックのアタッチ:

extension.json 内:

{
	"Hooks": {
		"ParserBeforeStrip": "MyExtensionHooks::onParserBeforeStrip"
	}
}

MediaWiki 1.25 以前では:

$wgHooks['ParserBeforeStrip'][] = 'MyExtensionHooks::onParserBeforeStrip';
呼び出し元:ファイル: parser/Parser.php

フックの付け方の詳細はManual:フックの情報を参照してください。
このフックを使用する拡張機能の例については、Category:ParserBeforeStrip extensions/ja を参照してください。

詳細

Note that this hook is not run on cached page content. And is also run when parsing system messages in addition to the page text.

$text will hold the text being parsed. To change the text being parsed, modify this value. E.g. to add the phrase "The mighty oracle gives forth this proclamation: " to the front of the text being parsed, you would use the following code:

$text = "The mighty oracle gives forth this proclamation: " . $text;
If you are just adding things to the start/end of a page's body and don't need it to actually be integrated into the parsing process you should consider using a separate hook to add/prepend that content instead.

関連項目