Template:Preview Only Infobox: Difference between revisions
m (tweak to step 5) |
m (corrected a mistake in the code) |
||
(11 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<onlyinclude><includeonly>{{#switch:{{{disable|}}}|no documentation|no doc|ncnd|ndnc|nd=|#default={{#if:{{REVISIONID}}||<div style="border: 4px #AA0000 solid;"><div style="margin: 4px; padding: 4px; text-align: center; font-weight: bold; color: #AA0000; font-size: 1.6em;">This Documentation is only visible in preview mode!</div>{{{1|}}}</div>}}}}</includeonly></onlyinclude> | <onlyinclude><includeonly>{{#switch:{{{disable|}}}|no documentation|no doc|ncnd|ndnc|nd=|#default={{#if:{{REVISIONID}}||<div style="border: 4px #AA0000 solid;"><div style="margin: 4px; padding: 4px; text-align: center; font-weight: bold; color: #AA0000; font-size: 1.6em;">This Documentation is only visible in preview mode!</div>{{{1|}}}</div>}}}}</includeonly></onlyinclude> | ||
==Usage== | ==Usage== | ||
This template was originally designed to provide help and support to editors when viewing a page in "preview mode". It's since been expanded upon and now provides several different versions of preview mode assistance that will hopefully help editors even further. To see a full list of existing | This template was originally designed to provide help and support to editors when viewing a page in "preview mode". It's since been expanded upon and now provides several different versions of preview mode assistance that will hopefully help editors even further. | ||
<br> | * To see a full list of existing templates with this feature, please see [[:Template:Preview Only Infobox/List|this page]]. | ||
* If you would like to test out a good preview only infobox example then I recommend you check out the [[Template:Item Statistics|Item Statistics]] template. | |||
* You can also visit the [[:Template:Item Statistics/Help|Item Statistics/Help]] page and checkout the code. | |||
If you would like to add this feature to a template, follow the steps below. | |||
<br><br> | |||
'''Step 1:''' Create a new sub-page of the template in question. As our example: [[:Template:Used In/Help]]<br><br> | '''Step 1:''' Create a new sub-page of the template in question. As our example: [[:Template:Used In/Help]]<br><br> | ||
'''Step 2:''' Paste the below code onto the page. Ensure to tailor the code to your template ie. replace "Template Name" with the required template name, include the associated parameters, etc.<br><br> | '''Step 2:''' Paste the below code onto the page. Ensure to tailor the code to your template ie. replace "Template Name" with the required template name, include the associated parameters, etc.<br><br> | ||
Unfortunately the <nowiki><pre></ | Unfortunately the wiki markups '''<nowiki>< pre ></nowiki>''' & '''<nowiki>< includeonly ></nowiki>''' cannot be displayed correctly, due to how they function. When copy and pasting this section, please '''remove the spaces''' from these markups. There's two <nowiki>< includeonly ></nowiki>'s that can be found both at the very beginning and very end of the code. There is also two <nowiki>< pre >'s</nowiki> that can be found within the "boilerplate" and "help" sections. | ||
<pre><includeonly>{{#switch:{{lc:{{{1|}}}}}<!-- | |||
<pre>< includeonly >{{#switch:{{lc:{{{1|}}}}}<!-- | |||
-->|bp|boilerplate = | -->|bp|boilerplate = | ||
Line 13: | Line 19: | ||
<pre>{{Template Name | <pre>{{Template Name | ||
| = add as many parameters as required | | = add as many parameters as required | ||
}}<pre>|disable={{{1|}}}}}<!-- | }}< /pre>|disable={{{1|}}}}}<!-- | ||
-->|help = | -->|help = | ||
Line 19: | Line 25: | ||
<pre>{{Template Name | <pre>{{Template Name | ||
| parameter = {short explanation on how each one should be filled out} | | parameter = {short explanation on how each one should be filled out} | ||
}}<pre>|disable={{{1|}}}}}<!-- | }}< /pre>|disable={{{1|}}}}}<!-- | ||
-->|fd = {{Preview Only Infobox|{{Template:Name/Documentation}} | -->|fd = {{Preview Only Infobox|{{Template:Name/Documentation}} | ||
Line 32: | Line 38: | ||
-->|#default = {{Preview Only Infobox|{{Preview Only Infobox/Default}}}}}} | -->|#default = {{Preview Only Infobox|{{Preview Only Infobox/Default}}}}}} | ||
</includeonly></pre><br> | </ includeonly ></pre><br> | ||
'''Step 3:''' Decide whether you would prefer the preview only infobox to display as default or when the editor "turns it on". The copied text from step 2 is set to display as default. To change this, change the <nowiki>#default</nowiki> line to the following: | '''Step 3:''' Decide whether you would prefer the preview only infobox to display as default or when the editor "turns it on". The copied text from step 2 is set to display as default. To change this, change the <nowiki>#default</nowiki> line to the following: | ||
<pre>-->|#default = }}</pre><br> | <pre>-->|#default = }}</pre><br> | ||
'''Step 4:''' Add the following code to the top of the original template page in question. To continue our example, this would be on page [[:Template:Used In]]. | '''Step 4:''' Add the following code to the top of the original template page in question. To continue our example, this would be on page [[:Template:Used In]]. | ||
<pre><includeonly>{{ | <pre>< includeonly >< onlyinclude > {{Template Name/Help|{{{1}}}}}< /onlyinclude >< /includeonly ></pre> | ||
If an "<nowiki>< includeonly ></nowiki>" and/or "<nowiki>< onlyinclude ></nowiki>" are already present on the template page, simply slot this code in above everything, on the very first line.<br><br> | |||
'''Step 5:''' If your template page has documentation, it needs moving to its own sub-page. In our example, this would be moved to [[:Template:Used In/Documentation]]. This documentation then needs transcluding back onto the template page. To do this use this following code and if this step isn't completed, the command "fd" sadly won't work. | '''Step 5:''' If your template page has documentation, it needs moving to its own sub-page. In our example, this would be moved to [[:Template:Used In/Documentation]]. This documentation then needs transcluding back onto the template page. To do this use this following code and if this step isn't completed, the command "fd" sadly won't work. | ||
<pre>{{Template Name/Documentation}}</pre><br> | <pre>{{Template Name/Documentation}}</pre><br> | ||
'''Step 6:''' Add the template to the list of templates that have preview window infoboxes on [[Template:Preview Only Infobox/List|this page]].<br> | '''Step 6:''' Add the template to the list of templates that have preview window infoboxes on [[:Template:Preview Only Infobox/List|this page]].<br> | ||
'''Step 7:''' Test that it works! The following commands will appear when you type the code <nowiki>{{Template Name|}}</nowiki> on any page. | '''Step 7:''' Test that it works! The following commands will appear when you type the code <nowiki>{{Template Name|}}</nowiki> on any page. | ||
{{#section:Template:Preview Only Infobox/Default|commands}}<!-- | {{#section:Template:Preview Only Infobox/Default|commands}} | ||
== Optional Steps == | |||
These optional steps can be taken to further expand the preview window assistance. | |||
=== Adding Extra Commands === | |||
'''Step 1:''' On the "Template:Template Name/Help" page, add the following code on its own line. | |||
<pre>-->|??? = {{Preview Only Infobox| | |||
preview message | |||
|disable={{{1|}}}}}<!--</pre> | |||
'''Step 2:''' Replace ??? with the command name of choice (currently existing examples: nd, help, list etc.). <br> | |||
'''Step 3:''' Replace "preview message" with your own. This can include custom boilerplates, additional documentation, transclusions etc.<br> | |||
'''Step 4:''' Find "| #default = ". If it is set as blank, skip to step 5. If it is set to display the <nowiki>{{Preview Only Infobox/Default</nowiki> list of commands, update it to reflect the following. The '''extra #''' and '''extra # message''' can be used 1 through to 10. | |||
<pre> | |||
-->|#default = {{Preview Only Infobox|{{Preview Only Infobox/Default | |||
| extra 1 = ??? | |||
| extra 1 message = description of the ??? command. | |||
}}}}}}</pre> | |||
'''Step 5:''' Now find "| command = ". Update this with the same code as step 4 above but using "| command = " in place of " |#default = ".<br> | |||
'''Step 6:''' As in step 2, replace the ??? with the command name of choice.<br> | |||
'''Step 7:''' Replace the description to briefly inform the editor of its purpose. The new command will now automatically appear in the preview window. | |||
preserving the orignially documentation and some hopefully unneeded code. | <!--preserving the orignially documentation and some hopefully unneeded code. | ||
*'''First unnamed Parameter''' (optional): You can set the first unnamed parameter to: | *'''First unnamed Parameter''' (optional): You can set the first unnamed parameter to: |
Latest revision as of 23:16, 13 September 2024
Usage
This template was originally designed to provide help and support to editors when viewing a page in "preview mode". It's since been expanded upon and now provides several different versions of preview mode assistance that will hopefully help editors even further.
- To see a full list of existing templates with this feature, please see this page.
- If you would like to test out a good preview only infobox example then I recommend you check out the Item Statistics template.
- You can also visit the Item Statistics/Help page and checkout the code.
If you would like to add this feature to a template, follow the steps below.
Step 1: Create a new sub-page of the template in question. As our example: Template:Used In/Help
Step 2: Paste the below code onto the page. Ensure to tailor the code to your template ie. replace "Template Name" with the required template name, include the associated parameters, etc.
Unfortunately the wiki markups < pre > & < includeonly > cannot be displayed correctly, due to how they function. When copy and pasting this section, please remove the spaces from these markups. There's two < includeonly >'s that can be found both at the very beginning and very end of the code. There is also two < pre >'s that can be found within the "boilerplate" and "help" sections.
< includeonly >{{#switch:{{lc:{{{1|}}}}}<!-- -->|bp|boilerplate = {{Preview Only Infobox|These parameters are the ones most commmonly used for the Horizon server. <pre>{{Template Name | = add as many parameters as required }}< /pre>|disable={{{1|}}}}}<!-- -->|help = {{Preview Only Infobox| <pre>{{Template Name | parameter = {short explanation on how each one should be filled out} }}< /pre>|disable={{{1|}}}}}<!-- -->|fd = {{Preview Only Infobox|{{Template:Name/Documentation}} |disable={{{1|}}}}}<!-- -->|nd|no documentation = <!-- -->|list = {{Preview Only Infobox|{{Preview Only Infobox/List}} |disable={{{1|}}}}}<!-- -->|command|commands = {{Preview Only Infobox|{{Preview Only Infobox/Default}}}}<!-- -->|#default = {{Preview Only Infobox|{{Preview Only Infobox/Default}}}}}} </ includeonly >
Step 3: Decide whether you would prefer the preview only infobox to display as default or when the editor "turns it on". The copied text from step 2 is set to display as default. To change this, change the #default line to the following:
-->|#default = }}
Step 4: Add the following code to the top of the original template page in question. To continue our example, this would be on page Template:Used In.
< includeonly >< onlyinclude > {{Template Name/Help|{{{1}}}}}< /onlyinclude >< /includeonly >
If an "< includeonly >" and/or "< onlyinclude >" are already present on the template page, simply slot this code in above everything, on the very first line.
Step 5: If your template page has documentation, it needs moving to its own sub-page. In our example, this would be moved to Template:Used In/Documentation. This documentation then needs transcluding back onto the template page. To do this use this following code and if this step isn't completed, the command "fd" sadly won't work.
{{Template Name/Documentation}}
Step 6: Add the template to the list of templates that have preview window infoboxes on this page.
Step 7: Test that it works! The following commands will appear when you type the code {{Template Name|}} on any page.
- {{Template Name|bp: displays a boilerplate of this template.
- {{Template Name|command: dislays this list of available commands.
- {{Template Name|fd: provides the template's full documentation.
- {{Template Name|help: displays parameter help.
- {{Template Name|list: generates a list of all templates that have preview window assistance.
- {{Template Name|nd: removes this documentation.
Optional Steps
These optional steps can be taken to further expand the preview window assistance.
Adding Extra Commands
Step 1: On the "Template:Template Name/Help" page, add the following code on its own line.
-->|??? = {{Preview Only Infobox| preview message |disable={{{1|}}}}}<!--
Step 2: Replace ??? with the command name of choice (currently existing examples: nd, help, list etc.).
Step 3: Replace "preview message" with your own. This can include custom boilerplates, additional documentation, transclusions etc.
Step 4: Find "| #default = ". If it is set as blank, skip to step 5. If it is set to display the {{Preview Only Infobox/Default list of commands, update it to reflect the following. The extra # and extra # message can be used 1 through to 10.
-->|#default = {{Preview Only Infobox|{{Preview Only Infobox/Default | extra 1 = ??? | extra 1 message = description of the ??? command. }}}}}}
Step 5: Now find "| command = ". Update this with the same code as step 4 above but using "| command = " in place of " |#default = ".
Step 6: As in step 2, replace the ??? with the command name of choice.
Step 7: Replace the description to briefly inform the editor of its purpose. The new command will now automatically appear in the preview window.