Template:Doc/doc: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
<noinclude>[[Category:English]]{{doc|0}}</noinclude>__NOTOC__ | <noinclude>[[Category:English]]{{doc|0}}</noinclude>__NOTOC__ | ||
The template <kbd>{{tl|doc}}</kbd> is designed to add a block of documentation to various pages (mainly template pages). The subpages of a certain language will be loaded into the documentation block depending on the language of the user interface. In the case of English, the documentation will be taken from the {{ | The template <kbd>{{tl|doc}}</kbd> is designed to add a block of documentation to various pages (mainly template pages). The subpages of a certain language will be loaded into the documentation block depending on the language of the user interface. In the case of English, the documentation will be taken from the {{code|desaturated|<kbd>/doc</kbd>}} subpage. But in all other cases, the documentation will be taken from the subpage {{code|desaturated|<kbd>/doc/<[[Template:Lang|lang code]]></kbd>}} | ||
==Tools== | ==Tools== | ||
The main tools are located on the top right, above the documentation block: | The main tools are located on the top right, above the documentation block: | ||
*{{ | *{{code|outlined|Create}} – opens the creation of the documentation page. Appears only if the documentation page does not exist. | ||
*{{ | *{{code|outlined|View}} – opens the documentation page. | ||
*{{ | *{{code|outlined|Edit}} – opens the editing of the documentation page. | ||
*{{ | *{{code|outlined|History}} – opens the history of changes to the documentation page. | ||
{{note|If there are none of the above tools, then the text of the documentation was written using the {{param|content}} parameter, or parameter {{param|tools}} was set to 0.}} | {{note|If there are none of the above tools, then the text of the documentation was written using the {{param|content}} parameter, or parameter {{param|tools}} was set to 0.}} | ||
Also, in the upper right corner there is a button marked with an ellipsis [ '''…''' ]. It expands/collapses additional tools: | Also, in the upper right corner there is a button marked with an ellipsis [ '''…''' ]. It expands/collapses additional tools: | ||
*{{ | *{{code|outlined|Sandbox}} – opens the creation of a subpage {{code|desaturated|<kbd>/sandbox</kbd>}} and copies the code of the original page, or, if this page exists, simply opens it. | ||
*{{ | *{{code|outlined|Testcases}} – opens the {{code|desaturated|<kbd>/testcases</kbd>}} subpage. Useful for testing a template in different situations. | ||
*{{ | *{{code|outlined|Subpages}} – opens [[Special:PrefixIndex]] and inserts the page name to search for all subpages. | ||
*{{ | *{{code|outlined|Purge}} – opens a window with a message about purging the page. | ||
==Language bar== | ==Language bar== | ||
On the top right, under the tools, there are flags that switch documentation to another language. Switching is implemented by inserting {{ | On the top right, under the tools, there are flags that switch documentation to another language. Switching is implemented by inserting {{code|desaturated|2=<kbd>&uselang=<[[Template:Lang|lang code]]></kbd>}} into the page link, so if you click on another language, then along with the documentation, the interface language will change. | ||
If there is no documentation in a certain language, the message “The <page> documentation page does not exist” will be displayed. if {{param|pagespace}} or actual page space is {{code|User}}, then the message “The <user> did not provide information about himself on this language (<page>).” will be displayed instead. Also, after this message, documentation in English will be displayed, if it exists. | |||
If there is no documentation in a certain language, the message “The <page> documentation page does not exist” will be displayed. if {{param|pagespace}} or actual page space is {{ | |||
==Parameters== | ==Parameters== | ||
Line 44: | Line 42: | ||
**1 – only buttons “Create”, “View”, “Edit” and “History”. | **1 – only buttons “Create”, “View”, “Edit” and “History”. | ||
**In all other cases there will be all buttons | **In all other cases there will be all buttons | ||
*{{param|examples}}: examples that can be copied and used on other pages go here. When used, the “Examples” button appears, on the left under the title of the documentation block. | *{{param|examples}}: examples that can be copied and used on other pages go here. When used, the “Examples” button appears, on the left under the title of the documentation block. | ||
*{{param|noscroll}}: if you are using the {{param|examples}} parameter with few examples, this setting will turn off the right extra padding (scrollbar-gutter) needed for the scrollbar. | *{{param|noscroll}}: if you are using the {{param|examples}} parameter with few examples, this setting will turn off the right extra padding (scrollbar-gutter) needed for the scrollbar. | ||
==Creating documentation== | ==Creating documentation== | ||
{{warning|If you want to add the symbol “|” somewhere in the text (templates and other MediaWiki elements are not affected), use {{ | {{warning|If you want to add the symbol “|” somewhere in the text (templates and other MediaWiki elements are not affected), use {{code|select=1|&#124;}}.}} | ||
To start creating documentation, click on the “Create” button on the top right. At the very beginning of the documentation, add the template <kbd>{{tl|doc}}</kbd> and enter 0 in the parameter {{param|1}}. After that, you will see a message stating that this is a documentation subpage. And so that this message does not appear in the documentation block, it should be written in this way: | To start creating documentation, click on the “Create” button on the top right. At the very beginning of the documentation, add the template <kbd>{{tl|doc}}</kbd> and enter 0 in the parameter {{param|1}}. After that, you will see a message stating that this is a documentation subpage. And so that this message does not appear in the documentation block, it should be written in this way: | ||
{{ | {{code|select=1|<nowiki><noinclude>{{doc|0}}</noinclude></nowiki>}} | ||
Then the text of the documentation itself is written. First there is a brief description, and then – depending on what the documentation is written for. | Then the text of the documentation itself is written. First there is a brief description, and then – depending on what the documentation is written for. |
Revision as of 12:34, 23 January 2023

Don't forget to purge the contents of the base page upon creating or editing this subpage.
The template {{doc}}
is designed to add a block of documentation to various pages (mainly template pages). The subpages of a certain language will be loaded into the documentation block depending on the language of the user interface. In the case of English, the documentation will be taken from the desaturated subpage. But in all other cases, the documentation will be taken from the subpage desaturated
Tools
The main tools are located on the top right, above the documentation block:
- outlined – opens the creation of the documentation page. Appears only if the documentation page does not exist.
- outlined – opens the documentation page.
- outlined – opens the editing of the documentation page.
- outlined – opens the history of changes to the documentation page.

Also, in the upper right corner there is a button marked with an ellipsis [ … ]. It expands/collapses additional tools:
- outlined – opens the creation of a subpage desaturated and copies the code of the original page, or, if this page exists, simply opens it.
- outlined – opens the desaturated subpage. Useful for testing a template in different situations.
- outlined – opens Special:PrefixIndex and inserts the page name to search for all subpages.
- outlined – opens a window with a message about purging the page.
Language bar
On the top right, under the tools, there are flags that switch documentation to another language. Switching is implemented by inserting desaturated into the page link, so if you click on another language, then along with the documentation, the interface language will change.
If there is no documentation in a certain language, the message “The <page> documentation page does not exist” will be displayed. if {{{pagespace}}} or actual page space is User, then the message “The <user> did not provide information about himself on this language (<page>).” will be displayed instead. Also, after this message, documentation in English will be displayed, if it exists.
Parameters
- {{{1}}}: parameter for switching the template assignment:
- If you need a standard documentation block, do not enter anything in this parameter.
- 0 – will display the message “This is a documentation subpage for <page>”.
- 1 – will display the message “This is the sandbox subpage for <page>”.
- 2 – will display the message “This page is not a sandbox”.
- 3 – will display the message “This is the <page> info subpage”. Useful for user subpages.
- 4 – will display the message “This is a documentation subpage for use on multiple pages”. If the {{{list}}} parameter is used, then the text will be: “This is a documentation subpage for use on multiple pages listed in <list page>”.
- {{{list}}}: specifies a page or category that lists pages using a particular documentation page. Used only if parameter {{{1}}} is set to 4.
- {{{docpage}}}: the page that will be used as documentation.
- {{{content</lang code>}}}: content that will be used as documentation, instead of a separate page. When used, the main tools are hidden.
- {{{pagespace}}}: the page space is determined automatically, but you can enter your own. The text in the header depends on this parameter:
- Template → “Template Documentation”
- File → “Summary”
- User → “About”
- In all other cases it will be “Documentation”

- {{{tools}}}: controls which tool buttons should be displayed:
- 0 – no buttons.
- 1 – only buttons “Create”, “View”, “Edit” and “History”.
- In all other cases there will be all buttons
- {{{examples}}}: examples that can be copied and used on other pages go here. When used, the “Examples” button appears, on the left under the title of the documentation block.
- {{{noscroll}}}: if you are using the {{{examples}}} parameter with few examples, this setting will turn off the right extra padding (scrollbar-gutter) needed for the scrollbar.
Creating documentation

To start creating documentation, click on the “Create” button on the top right. At the very beginning of the documentation, add the template {{doc}}
and enter 0 in the parameter {{{1}}}. After that, you will see a message stating that this is a documentation subpage. And so that this message does not appear in the documentation block, it should be written in this way:
<noinclude>{{doc|0}}</noinclude>
Then the text of the documentation itself is written. First there is a brief description, and then – depending on what the documentation is written for.