跳转到内容

模板:Codesample-header

来自天灾之下:危险连接资料站
wiki>Matma Rex2024年11月23日 (六) 10:42的版本 (Extracted from Template:Codesample, to allow using it with normal <syntaxhighlight> markup)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
{{{1}}}
模板文档

Usage

Header for a syntax-highlighted code fragment.

模板参数[编辑模板数据]

此模板首选参数不换行的行内格式。

参数描述类型状态
Title1

Title (name) of this code sample. Often a filename

示例值
includes/specials/SpecialBlankpage.php
字符串必需

Example

This wikitext:

{{Codesample-header|[https://gerrit.wikimedia.org/g/mediawiki/core/+/REL1_43/includes/specials/SpecialBlankpage.php includes/specials/SpecialBlankpage.php]}}

<syntaxhighlight lang="php">
	public function execute( $par ) {
		$this->setHeaders();
		$this->getOutput()->addWikiMsg( 'intentionallyblankpage' );
	}
</syntaxhighlight>

Displays as:

	public function execute( $par ) {
		$this->setHeaders();
		$this->getOutput()->addWikiMsg( 'intentionallyblankpage' );
	}

See also