模板: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.
重定向
[編輯]{{模板文檔}}重定向至此處。
上述文檔嵌入自Template:Documentation/doc。 (編輯 | 歷史) 編者可以在本模板的沙盒 (創建 | 鏡像)和測試樣例 (創建)頁面進行實驗。 請在/doc子頁面中添加分類。 本模板的子頁面。 |