User:Johan G/Template:Informative template with preloaded text: Difference between revisions
m (fix: Broken link to preload text) |
(*Intermediate break* trying to get correct parts rendering in correct circumstance and setting up error messages to help users troubleshoot) |
||
Line 1: | Line 1: | ||
<noinclude> | |||
{{userpage draft|template|See also [[User talk:Johan G/Template:Informative template with preloaded text|discussion page]]}} | |||
<!-- | <!-- | ||
THIS IS | THIS IS EXPERIMENTAL | ||
Se discussion page | |||
--> | |||
<nowiki>1 is not empty | |||
use 1 | |||
doc is empty | |||
/doc exist | |||
use /doc | |||
/doc do not exist | |||
doc is not empty | |||
doc point to /doc | |||
use doc | |||
doc do not point to /doc | |||
use doc | |||
throw error | |||
1 is empty | |||
doc is empty | |||
/doc exist | |||
use /doc | |||
/doc do not exist | |||
encourage writing doc | |||
doc is not empty | |||
doc point to /doc | |||
use doc | |||
doc do not point to /doc | |||
use doc | |||
throw error</nowiki> | |||
<nowiki>[[{{FULLPAGENAME}}/doc]]</nowiki> | |||
[[{{FULLPAGENAME}}/doc]] | |||
<nowiki>{{#ifexist: {{{doc|-{{FULLPAGENAME}}/doc}}} <!-- Does /doc or page in doc exist? --> | |||
| Yes, /doc or page in doc exist | |||
yes | |||
| No, /doc or page in doc does not exist | |||
no | |||
}}</nowiki> | |||
{{#ifexist: {{{doc|-{{FULLPAGENAME}}/doc}}} | |||
| | |||
yes | |||
| | |||
no | |||
}} | |||
<nowiki>{{#ifeq: {{{doc|-{{FULLPAGENAME}}/doc}}} | {{FULLPAGENAME}}/doc <!-- If defined, does doc point to /doc? --> | |||
| | |||
equal | |||
| | |||
{{error|Page '''{{FULLPAGENAME}}/doc''' exist, but parameter '''doc''' points to '''{{{doc}}}'''|User:Johan G/Template:Informative template with preloaded text}} | |||
}}</nowiki> | |||
{{#ifeq: {{{doc|-{{FULLPAGENAME}}/doc}}} | {{FULLPAGENAME}}/doc | |||
| | |||
equal | |||
| | |||
{{error|Page '''{{FULLPAGENAME}}/doc''' exist, but parameter '''doc''' points to '''{{{doc}}}'''|User:Johan G/Template:Informative template with preloaded text}} | |||
}} | |||
</noinclude><includeonly> | </noinclude><includeonly> | ||
__NOEDITSECTION__ | __NOEDITSECTION__ | ||
__NOTOC__ | __NOTOC__ | ||
<div class="sjabdocnoot" style="color:grey; text-align:center; margin-top:1em;"><small>'''The following template description is not displayed when the template is inserted in an article.'''</small></div> | <div class="sjabdocnoot" style="color:grey; text-align:center; margin-top:1em;"><small>'''The following template description is not displayed when the template is inserted in an article.'''</small></div><!-- | ||
{{#if: {{{1|{{{doc| | |||
| <!-- | -->1{{#if: {{{1|{{#ifexist: {{{doc|{{FULLPAGENAME}}/doc}}} | yes}} }}} <!-- Are 1 or doc defined or /doc exists? --> | ||
| <!-- Yes, 1 or doc defined or /doc exists --> | |||
<div class="toccolours template-documentation" style="background: #FFFFEE; border: 1px solid #FFDAB9;font-size:100%"> | <div class="toccolours template-documentation" style="background: #FFFFEE; border: 1px solid #FFDAB9;font-size:100%"> | ||
<div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex; line-height: 1.6"> | <div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex; line-height: 1.6"> | ||
<span style="font-weight: bold; font-size: 125%">Template documentation</span> | <span style="font-weight: bold; font-size: 125%">Template documentation</span><!-- | ||
{{# | -->3{{#ifexist: {{{doc|{{FULLPAGENAME}}/doc}}} <!-- Is doc defined or /doc exists? --> | ||
| <!-- Yes, | | <!-- Yes, doc is defined or /doc exists --> | ||
<span class="plainlinks" style="font-size: small"> | <span class="plainlinks" style="font-size: small"> | ||
[ | [ | ||
[{{{doc|{{fullurl:{{FULLPAGENAME}}/doc}}}}} View] | [{{{doc|{{fullurl:{{FULLPAGENAME}}/doc}} }}} View] | ||
] | ] | ||
[ | [ | ||
[{{{doc|{{fullurl:{{FULLPAGENAME}}/doc|action=edit}}}}} Edit] | [{{{doc|{{fullurl:{{FULLPAGENAME}}/doc|action=edit}} }}} Edit] | ||
] | ] | ||
[ | [ | ||
[{{{doc|{{fullurl:{{FULLPAGENAME}}/doc|action=history}}}}} History] | [{{{doc|{{fullurl:{{FULLPAGENAME}}/doc|action=history}} }}} History] | ||
] | ] | ||
[ | [ | ||
[{{{doc|{{fullurl:{{FULLPAGENAME}}/doc|action=purge}}}}} Purge] | [{{{doc|{{fullurl:{{FULLPAGENAME}}/doc|action=purge}} }}} Purge] | ||
]</span> | ] | ||
}} | </span><!-- | ||
-->}}4 | |||
</div> | </div> | ||
{{{1|}}} | {{{1|}}} | ||
{{{{{doc|{{FULLPAGENAME}}/doc}}}}} | {{ {{{doc|{{FULLPAGENAME}}/doc}}} }} | ||
</div> | </div> | ||
<div class="toccolours template-documentation" style="background: #FFFFEE; border: 1px solid #FFDAB9;font-size:100%"> | <div class="toccolours template-documentation" style="background: #FFFFEE; border: 1px solid #FFDAB9;font-size:100%"> | ||
The above documentation is transcluded from [[{{{doc|{{FULLPAGENAME}}/doc}}}]]. <span class="plainlinks">([{{{doc|{{fullurl:{{FULLPAGENAME}}/doc|action=edit}}}}} Edit] {{!}} [{{{doc|{{fullurl:{{FULLPAGENAME}}/doc|action=history}}}}} History])</span> | The above documentation is transcluded from [[{{{doc|{{FULLPAGENAME}}/doc}}}]]. <span class="plainlinks">([{{{doc|{{fullurl:{{FULLPAGENAME}}/doc|action=edit}} }}} Edit] {{!}} [{{{doc|{{fullurl:{{FULLPAGENAME}}/doc|action=history}} }}} History])</span><!-- | ||
{{#if: {{{link box|}}} | -->5{{#if: {{{link box|}}} | ||
| | | | ||
</br> | </br> | ||
{{{link box}}} | {{{link box}}}<!-- | ||
}} | -->}}6 | ||
| <!-- No, neither 1 or doc defined or /doc exists, ask the reader to write documentation --> | |||
<div class="toccolours template-documentation" style="background: #FFFFEE; border: 1px solid #FFDAB9;font-size:100%"> | |||
| <!-- | |||
<div class="toccolours template-documentation" style="background: #FFFFEE; border: 1px solid #FFDAB9;font-size:100% | |||
[{{fullurl:{{FULLPAGENAME}}/doc|action=edit&preload=User:Johan_G/Template:Informative_template_with_preloaded_text/preload_text}} Click here to create documentation for this template]. | [{{fullurl:{{FULLPAGENAME}}/doc|action=edit&preload=User:Johan_G/Template:Informative_template_with_preloaded_text/preload_text}} Click here to create documentation for this template]. | ||
</div> | </div> | ||
}} | }}2</includeonly><noinclude> | ||
</includeonly><noinclude> | |||
{{User:Johan G/Template:Informative template with preloaded text}} | {{User:Johan G/Template:Informative template with preloaded text}} | ||
</noinclude | </noinclude> | ||
Revision as of 15:52, 25 June 2019
This template is a draft on a userpage.
See also discussion page
|
1 is not empty use 1 doc is empty /doc exist use /doc /doc do not exist doc is not empty doc point to /doc use doc doc do not point to /doc use doc throw error 1 is empty doc is empty /doc exist use /doc /doc do not exist encourage writing doc doc is not empty doc point to /doc use doc doc do not point to /doc use doc throw error
[[{{FULLPAGENAME}}/doc]]
User:Johan G/Template:Informative template with preloaded text/doc
{{#ifexist: {{{doc|-{{FULLPAGENAME}}/doc}}} <!-- Does /doc or page in doc exist? --> | Yes, /doc or page in doc exist yes | No, /doc or page in doc does not exist no }}
no
{{#ifeq: {{{doc|-{{FULLPAGENAME}}/doc}}} | {{FULLPAGENAME}}/doc <!-- If defined, does doc point to /doc? --> | equal | {{error|Page '''{{FULLPAGENAME}}/doc''' exist, but parameter '''doc''' points to '''{{{doc}}}'''|User:Johan G/Template:Informative template with preloaded text}} }}
{{User:Johan G/Template:Informative template with preloaded text}}: Page User:Johan G/Template:Informative template with preloaded text/doc exist, but parameter doc points to {{{doc}}}
1
This template is used when documenting templates.
Optionally the documentation can be put on a separate page, typically a subpage to the template, named /doc
.
If the template is put on a page without a /doc
subpage, or no link is given to a subpage with documentation, clicking a link labeled "Click here to create documentation for this template" will open a skeleton page for template documentation.
Usage
The template is used with one variable and must be put between <noinclude></noinclude>
tags.
Note Please put the <noinclude>
tag right behind the intended contents of the template, as an empty line or extra spaces will alter the way the template is rendered.
{{User:Johan G/Template:Informative template with preloaded text | 1= | doc= | link box= }}
If documentation is the same page as the template 1 is mandatory. Otherwise all parameters are optional.
- For some content the text in 1 and link box must start on a new line (see examples below). Some formatting will otherwise fail.
- 1
- Will allow wiki markup to be used above or instead of a separate documentation page.
- doc
- Name of page with documentation
- If content is empty doc will default to
{{FULLPAGENAME}}/doc
- link box
- Will add content to the link box at the bottom
Examples
{{User:Johan G/Template:Informative template with preloaded text}}
Template loop detected: User:Johan G/Template:Informative template with preloaded text
{{User:Johan G/Template:Informative template with preloaded text | 1= Test }}
Template loop detected: User:Johan G/Template:Informative template with preloaded text
{{User:Johan G/Template:Informative template with preloaded text | 1= Test | link box=Test text}}
Template loop detected: User:Johan G/Template:Informative template with preloaded text
{{User:Johan G/Template:Informative template with preloaded text |doc=User:Johan G/Template:Informative template with preloaded text/doc}}
Template loop detected: User:Johan G/Template:Informative template with preloaded text
Technical details
When creating a template with the "Create documentation" link, the new page is preloaded from User:Johan G/Template:Informative template with preloaded text/preload text.
Known issues
This template is still under development.
Related templates
The above documentation is transcluded from User:Johan G/Template:Informative template with preloaded text/doc. (Edit | History)562