查看: 11599|回复: 0


发表于 2012-1-12 10:27:28 | 显示全部楼层 |阅读模式
参考自MediaWiki Handbook:
The template namespace is the namespace with prefix "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 [[Template:name]], 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.


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:


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 把一个图片的描述用作标题

使用道具 举报

您需要登录后才可以回帖 登录 | 注册




GMT+8, 2023-11-29 01:28 , Processed in 0.040501 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表