Template:Documentation/doc: Difference between revisions
创建页面,内容为“{{documentation header}} <!-- Documentation here --> {{Lua}} 对于模板,在末尾插入<code><nowiki>{{subst:doc}}</nowiki></code>,然后保存页面,这将放置<code><nowiki>{{documentation}}</nowiki></code>和一条建议编辑者在何处放置类别和interwiki链接的注释。对于其他类型的页面,文档模板应该存在。 单击页面顶部的“创建”将打开文档页面,并带有某些Template:Documentation/preload|预格…” |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
{{Lua}} | {{Lua}} | ||
For templates, insert <code><nowiki>{{subst:doc}}</nowiki></code> at the end and save the page. This will place <code><nowiki>{{documentation}}</nowiki></code> and a note suggesting where editors should place categories and interwiki links. For other types of pages, a documentation template should exist. | |||
Clicking "Create" at the top of the page will open the documentation page with some [[Template:Documentation/preload|preformatted]] content. You can also use <code><nowiki>{{subst:doc}}</nowiki></code> on the documentation page to create this format. | |||
Documentation pages will be automatically added to [[:Category:Documentation Pages]]. Using {{t|doc}} without <code>subst:</code> will add the page to [[:Category:Pages Needing Template Substitution]]. | |||
== | == Optional Parameters == | ||
When creating a page, you can add this parameter to the <code><nowiki>{{subst:doc}}</nowiki></code> template or to the <code><nowiki>{{documentation}}</nowiki></code> template. | |||
=== type === | === type === | ||
Set the "type" of documentation, such as template, module, message, etc. This will be used as part of some messages the template might display and for categorization. | |||
Type is automatically based on the namespace, so it usually doesn't need to be set. | |||
=== page === | === page === | ||
The page where the documentation is located. Defaults to a subpage of the current page called "doc." | |||
=== content === | === content === | ||
Allows specifying the documentation content directly, rather than on a separate subpage. Useful for subpage templates specific to small pages, like [[Explosion/table]]. | |||
=== nodoc === | === nodoc === | ||
If the template has no documentation and you don't know how to use it, add nodoc=1 to the documentation template on the documentation page. The background of the documentation will turn red to draw attention, and the page will be added to the category. | |||
* [[:Category: | * [[:Category:Templates Without Documentation]] | ||
* [[:Category: | * [[:Category:Modules Without Documentation]] | ||
If the documentation page doesn't exist or is empty, it's automatically set, so it usually doesn't need to be set. | |||
=== baddoc === | === baddoc === | ||
Similar to nodoc, it's used to mark templates that '''do''' have documentation, but it's not very good. This might mean it lacks enough examples, doesn't properly explain all features, or doesn't correctly explain the template's main points. The background of the documentation will turn yellow to stand out, and the page will be added to the category. | |||
* [[:Category: | * [[:Category:Templates with Poor Documentation Quality]] | ||
* [[:Category: | * [[:Category:Modules with Poor Documentation Quality]] | ||
<includeonly> | <includeonly> | ||
<!-- | <!-- Template categories/interwiki links --> | ||
[[ | [[zh:Template:Documentation]] | ||
</includeonly> | </includeonly> | ||
<noinclude> | <noinclude> | ||
<!-- | <!-- Documentation categories/interwiki links --> | ||
[[ | [[zh:Template:Documentation/doc]] | ||
</noinclude> | </noinclude> |
Latest revision as of 21:50, 9 November 2024
This template uses Module:Documentation, this script is written in Lua.
For more details, please refer to Wikipedia:Lua and Extension:Scribunto.
For templates, insert {{subst:doc}}
at the end and save the page. This will place {{documentation}}
and a note suggesting where editors should place categories and interwiki links. For other types of pages, a documentation template should exist.
Clicking "Create" at the top of the page will open the documentation page with some preformatted content. You can also use {{subst:doc}}
on the documentation page to create this format.
Documentation pages will be automatically added to Category:Documentation Pages. Using {{doc}} without subst:
will add the page to Category:Pages Needing Template Substitution.
Optional Parameters
When creating a page, you can add this parameter to the {{subst:doc}}
template or to the {{documentation}}
template.
type
Set the "type" of documentation, such as template, module, message, etc. This will be used as part of some messages the template might display and for categorization.
Type is automatically based on the namespace, so it usually doesn't need to be set.
page
The page where the documentation is located. Defaults to a subpage of the current page called "doc."
content
Allows specifying the documentation content directly, rather than on a separate subpage. Useful for subpage templates specific to small pages, like Explosion/table.
nodoc
If the template has no documentation and you don't know how to use it, add nodoc=1 to the documentation template on the documentation page. The background of the documentation will turn red to draw attention, and the page will be added to the category.
If the documentation page doesn't exist or is empty, it's automatically set, so it usually doesn't need to be set.
baddoc
Similar to nodoc, it's used to mark templates that do have documentation, but it's not very good. This might mean it lacks enough examples, doesn't properly explain all features, or doesn't correctly explain the template's main points. The background of the documentation will turn yellow to stand out, and the page will be added to the category.