User:Johan G/Template:Informative template with preloaded text: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(Created page with "<!-- THIS IS HIGHLY EXPERIMENTAL The main purpose (currently) is to see * If it is feasible to make a documentation template that allow for * One click loading of a new pa...")
 
m (Intermediate save)
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>
{{userpage draft|template|See also [[User talk:Johan G/Template:Informative template with preloaded text|discussion page]]}}
<!--
<!--


THIS IS HIGHLY EXPERIMENTAL
THIS IS EXPERIMENTAL


The main purpose (currently) is to see
Se discussion page
* If it is feasible to make a documentation template that allow for
  * One click loading of a new page with preloaded text with
    * A skeleton for writing documentation


If this _is_ feasible, the next question is:
-->
  * If it is feasible to rewrite current documentation (about 560 pages)?
<nowiki>1 or doc defined or /doc exist
  * By hand or automated?
    /doc exist
        doc defined
          doc = /doc
              1
              doc
            else
              1
              warn
              doc
      else
        1
        /doc
  else
    write /doc</nowiki>
 
Header
 
Top1
 
{{#if: {{{1|-{{{doc|{{#ifexist: {{FULLPAGENAME}}/doc | <!-- Yes -->}} }}} }}} <!-- Are 1 or doc defined or /doc exist? -->
  |  <!-- Yes, 1 or doc are defined or /doc exist -->
'''''1''' or '''doc''' are defined or '''/doc''' exist''
 
<!--
-->{{#ifexist: {{FULLPAGENAME}}/doc-  <!-- Is there a subpage /doc? -->
    | <!-- Yes, there is a subpage /doc -->
''There is a subpage '''/doc'''''
 
'''1'''
 
<!--
  -->{{#ifeq: {{{doc|{{FULLPAGENAME}}/doc}}} | {{FULLPAGENAME}}/doc  <!-- Do doc point to /doc? -->
      |  <!-- Yes, doc point to /doc -->
'''''doc''' point to '''/doc'''''
 
'''doc'''
 
Top2
 
'''Transcluded'''
 
Bottom2
 
      |  <!-- No, doc do not point to /doc -->
'''''doc''' do not point to '''/doc'''''
 
'''warning'''
 
'''doc'''
 
Bottom1
 
Top2
 
'''Transcluded'''
 
Bottom2
 
<!--
  -->}}
    |  <!-- No, there is no subpage /doc -->
''There is no subpage '''/doc'''''
 
'''1'''
 
'''doc'''
 
Top2
 
'''Transcluded'''
 
Bottom2
 
<!--
-->}}
  |  <!-- No, 1 and doc are not defined and /doc do not exist -->
'''''1''' and '''doc''' are not defined and '''/doc''' do not exist''
 
'''Write /doc!'''
}}
 
Bottom1


--><noinclude>
{{userpage draft|template|See also comments in the source}}
</noinclude><includeonly>
</noinclude><includeonly>
<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|{{{content|-}}}}}} <!-- Is both 1= and content= empty? -->
  | <!-- Yes, at least one of them is there. -->
<div class="toccolours template-documentation" style="background: #FFFFEE; border: 1px solid #FFDAB9;font-size:100%;">
__NOEDITSECTION__
__NOEDITSECTION__
__NOTOC__
__NOTOC__
{{{{{1|{{FULLPAGENAME}}/doc}}}}}
<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><!--
{{{content|}}}
 
-->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 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><!--
-->3{{#ifexist: {{{doc|{{FULLPAGENAME}}/doc}}}  <!-- Is doc defined or /doc exists? -->
  |  <!-- Yes, doc is defined or /doc exists -->
<span class="plainlinks" style="font-size: small">
[
[{{{doc|{{fullurl:{{FULLPAGENAME}}/doc}} }}} View]
]
[
[{{{doc|{{fullurl:{{FULLPAGENAME}}/doc|action=edit}} }}} Edit]
]
[
[{{{doc|{{fullurl:{{FULLPAGENAME}}/doc|action=history}} }}} History]
]
[
[{{{doc|{{fullurl:{{FULLPAGENAME}}/doc|action=purge}} }}} Purge]
]
</span><!--
-->}}4
</div>
</div>
<div class="toccolours template-documentation" style="background: #FFFFEE; border: 1px solid #FFDAB9;font-size:100%;">
{{{1|}}}
The above documentation is transcluded from [[{{FULLPAGENAME}}/doc]]. ([{{fullurl:{{FULLPAGENAME}}/doc|action=edit}} edit] {{!}} [{{fullurl:{{FULLPAGENAME}}/doc|action=history}} history])
{{ {{{doc|{{FULLPAGENAME}}/doc}}} }}
{{#if: {{{link box|}}}
</div>
<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><!--
-->5{{#if: {{{link box|}}}
|
|
</br>
</br>
{{{link box}}}
{{{link box}}}<!--
}}
-->}}6
</div>
  | <!-- No, neither 1 or doc defined or /doc exists, ask the reader to write documentation -->
| <!-- No, none of them is there.  Throw a message to the reader. -->
<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].
Please [{{fullurl:{{FULLPAGENAME}}/doc|action=edit&preload=User:Johan_G/Template:Informative_template_with_preloaded_text/preloaded_text}} add documentation].
</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>
TODO
 
* [{{fullurl:{{FULLPAGENAME}}/doc|action=edit&preload=User:Johan G/Template:Informative template with preloaded text/preloaded text}} Create documentation]
  See https://www.mediawiki.org/wiki/Manual:Creating_pages_with_preloaded_text#Loading_the_preload_file
  and https://www.mediawiki.org/wiki/Manual:Parameters_to_index.php#Options_affecting_the_edit_form
* Parameters 1, content= and link box=
* View, Edit, History and Purge buttons
* Separate documentation/style guide in either the documentation or as a separate page in the FlightGear wiki namespace.
* Unknowns
 
It seems that to be able to add documentation through preloading, you must add it as a separate page or as a new section.  Will this mean that all template documentation have to be painstakingly rewritten (that is about 560 pages currently)?  If so this will probably not be feasible. :-(
-->

Latest revision as of 14:54, 27 June 2019

This template is a draft on a userpage.

See also discussion page
Please suggest changes to this draft on the discussion page.

1 or doc defined or /doc exist
    /doc exist
        doc defined
          doc = /doc
              1
              doc
            else
              1
              warn
              doc
      else
        1
        /doc
  else
    write /doc

Header

Top1

1 or doc are defined or /doc exist

There is no subpage /doc

1

doc

Top2

Transcluded

Bottom2

Bottom1



The following template description is not displayed when the template is inserted in an article.

1

Template documentation3 [ View ] [ Edit ] [ History ] [ Purge ] 4


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