模板:Documentation/doc
這是 {{Documentation}} 模板的說明文件頁面。 本文件並不是為直接瀏覽而撰寫。若是其中使用了跨維基計劃連結,某些連結可能會顯示損毀。請勿將這些連結替換為硬編碼的頁面名稱或網址。 |
這個模板自動顯示「模板文件」框,就象你現在看到的這樣。文件框中的內容由其它頁面生成,
用法
[編輯]- 在主模板中增加
<noinclude>{{Documentation}}</noinclude>
。 - 點擊「編輯」連結,它將打開/doc子頁面,並在那裏填寫文件。
- 將分類與跨語言連結增加在/doc子頁面的
<includeonly></includeonly>
中。
正常的/doc子頁面
[編輯]<noinclude>{{Documentation}}</noinclude>
任意/doc子頁面
[編輯]<noinclude>{{Documentation|Template:any page/doc}}</noinclude>
內聯內容
[編輯]<noinclude>{{Documentation|content=这是一个文档。}}</noinclude>
有[查看][編輯]連結的內聯內容
[編輯]<noinclude>{{Documentation |1 = Template:模板名/doc |content ={{Template:模板名/doc|参数}} }}</noinclude>
Best practice
[編輯]This code should be added at the bottom of the template code, with no extra space before "<noinclude>
" (which would cause extra space on pages where the template is used). The parameter can be used as shown above to transclude an arbitrary documentation page.
Add categories and interwiki links to the documentation page inside <includeonly> </includeonly>
tags.
If the documentation page contains includeonly or noinclude tags as part of the documentation, replace the "<" with "<".
Customizing display
[編輯]Overrides exist to customize the output in special cases:
{{documentation| heading = ...}}
− change the text of the "documentation" heading. If this is set to blank, the entire heading line (including the first [edit] link) will also disappear.
功能
[編輯]If the documentation page doesn't exist, the "edit" link includes a preload parameter so that clicking it will pre-fill the edit form with the basic documentation page format.
Rationale
[編輯]- Use of this template allows templates to be protected where necessary, while allowing anyone to edit the documentation, categories, and interwiki links.
- Text on the template page itself adds to the amount of text which must be processed when displaying the template, which is limited for performance reasons: there is a pre-expand include size maximum of 2,048,000 bytes. Placing the documentation in a subpage reduces the wikitext for documentation on the template page itself to a template call and noinclude tags. MediaWiki developers have recommended this system for this reason.
重定向
[編輯]{{模板文件}}重定向至此處。