wangsisi 发表于 2012-1-12 10:27:28

Mediawiki的模板(一)

参考自MediaWiki Handbook:http://meta.wikimedia.org/wiki/Help:Template#Parameters
The template namespace is the namespace with prefix "Template:".
模板的名空间以“Template“为前缀.

A page in this namespace is called a template. The contents of such a page (either fixed or depending on parameters and/or variables) is designed to be useful for insertion in other pages (transclusion, creating a compound document).

The syntax for insertion of the page "Template:name" is {{name}}. This is called a template tag.

插入模板的标记是{{name}} “Template:name“
This reference in the wikitext causes insertion of the template content when the referring page is rendered. Various equivalent terms are:

calling the template 调用模板
referring to the template 涉及模板
including the template 包含模板
If the page "Template:name" does not exist, then {{name}} works as [], a link to a non-existing page, leading to the edit page. Thus, one way of making a template is putting the tag first, and then following the link.

如果”Template:name”不存在,那么{{name}}则链接到一个不存在的页面,可供编辑,这也是建立模板的一个方法.


If name starts with a valid namespace prefix, or a colon, then it is not prefixed with "Template:". This way any page can be used as template (a colon at the start refers to the main namespace). In the case of an image or category, it gives the description part. Using a page outside the template namespace as template can be useful for:

如果name以其他有效的名空间为前缀,这样任何的页面可以用作模板.在模板名空间外使用页面有时候很有用:

quoting interface messages in the MediaWiki namespace 提供mediawiki名空间消息接口
experimenting with templates in subpages of one's userpage 在用户子页面测试模板,“沙盒“
using the description of an image for a caption 把一个图片的描述用作标题
页: [1]
查看完整版本: Mediawiki的模板(一)

美国主机评测网站