Meta:Simple template documentation

From protonation
Jump to navigation Jump to search

Create a template called Template:Template documentation and put the following inside:

{| style="background: #d8fbe8; border: 1px solid #aaa; padding: .2em; margin-bottom: 3px; width: 100%;"
|-
|[[File:Template-info.png|70px|]] <span style="font-size:170%">''Template documentation''</span> <nowiki>[</nowiki>[[{{FULLPAGENAME}}/Documentation|edit]]<nowiki>]</nowiki><hr/><br/>
|-
| {{#ifexist: {{FULLPAGENAME}}/Documentation | {{{{PAGENAME}}/Documentation}} | There is currently no documentation. <nowiki>[</nowiki>[[{{FULLPAGENAME}}/Documentation|create]]<nowiki>]</nowiki>}}
|}

Then, go to every template and put near the end:

<noinclude>{{template documentation}}</noinclude>

Now every template page should look like this:

Template-info.png Template documentation [edit]

There is currently no documentation. [create]

By pressing create or edit, you, or any user, will create a subpage of the current template called Documentation where you can type the documentation of the current template. The full page name of documentation would look like: Template:Current template/Documentation.

Then, if you go back to current template page, it should look like this:

Template-info.png Template documentation [edit]

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.


Dialog-information on.svg You can enhance the documentation template in various ways:

  • You can put a help link somewhere to explain its usage.
  • You can invoke [[Category:Templates with documentation]].
  • You can make the blue edit link to link directly to edit mode instead of view mode. I kept it simple to avoid external links.


Attenzione architetto fr 01.svg Keep in mind that this template requires Extension:ParserFunctions. If you don't have ParserFunctions installed you can use an even simpler version:

{| style="background: #d8fbe8; border: 1px solid #aaa; padding: .2em; margin-bottom: 3px; width: 100%;"
|-
|[[File:Template-info.png|70px|]] <span style="font-size:170%">''Template documentation''</span> <nowiki>[</nowiki>[[{{FULLPAGENAME}}/Documentation|edit]]<nowiki>]</nowiki><hr/><br/>
|-
| {{{{PAGENAME}}/Documentation}}
|}


Attenzione architetto fr 01.svg It also requires InstantCommons. If you don't have InstantCommons enabled you can either

Result:

{{
i
}} Template documentation [edit]


There is currently no documentation. [create]

It uses CSS3 so it might look different in some browsers.

Sources

Comments

blog comments powered by Disqus