Difference between revisions of "Template:Extension"

From WPRDC Wiki
Jump to navigation Jump to search
>Egfrank~mediawikiwiki
(added to category:Categorizing templates)
>Egfrank~mediawikiwiki
(moved documentation to Template:Extension/Doc; added support for multiple types; fixed misc bugs re; missing, blank parameter values)
Line 1: Line 1:
<noinclude>
<includeonly>{| class="ext-infobox ext-status-{{#switch: {{lc: {{{status|unknown}}}}}|unstable|experimental|beta|stable={{{status}}}|unknown}}" style="float: right; background-color: white; min-width:20%;"
== Purpose ==
This template should be added to the main page of all extensions documented on this wiki (and only the main page).  It will add a useful infobox using the information supplied (see below) and will automatically add the extension to [[:Category:All extensions]], plus the appropriate [[:Category:Extensions by status|status]] and [[:Category:Extensions by type|type]] categories.
 
== Example ==
 
<!--********** THIS IS WHERE THE TEMPLATE STARTS **********--></noinclude>
{| class="ext-infobox ext-status-{{#switch: {{lc: {{{status|unknown}}}}}|unstable|experimental|beta|stable={{{status}}}|unknown}}" style="float: right; background-color: white; min-width:20%;"
|+ '''This is a [[:Category:Extensions|MediaWiki Extension]]'''
|+ '''This is a [[:Category:Extensions|MediaWiki Extension]]'''
|- class="ext-header"
|- class="ext-header"
! colspan="2" style="padding-top: 0.5em;" | [[Image:{{#ifeq: {{{status|}}}|unstable|Crystal Clear app error.png|Crystal Clear action run.png}}|left|40px]] <span style="font-size: 130%;">{{{name|{{PAGENAME}}}}}</span><br>
! colspan="2" style="padding-top: 0.5em;" | [[Image:{{#ifeq: {{{status|}}}|unstable|Crystal Clear app error.png|Crystal Clear action run.png}}|left|40px]] <span style="font-size: 130%;">{{#if:{{{name|}}}|{{{name}}}|{{PAGENAME}}}}</span><br>
Release status: {{#switch: {{lc: {{{status|unknown}}}}}|unstable|experimental|beta|stable={{{status}}}|unknown}} <includeonly>[[Category:{{#switch: {{lc:{{{status|}}}}}|unstable|experimental|stable={{{status}}} extensions|beta=beta status extensions|unknown|=extensions with unknown status|extensions with invalid status}}]]</includeonly>
Release status: {{#switch: {{lc: {{{status|unknown}}}}}|unstable|experimental|beta|stable={{{status}}}|#default=unknown}}  
{{#ifeq:{{{templatemode|}}}|nocats||[[Category:{{#switch: {{lc:{{{status|}}}}}|unstable|experimental|stable={{{status}}} extensions|beta=beta status extensions|unknown|=extensions with unknown status|#default=extensions with invalid status}}]]}}
|-
|-
{{#if:{{{image<includeonly>|</includeonly>}}}|
{{#if:{{{image|}}}|
<!-- -->{{!}} colspan="2" style="text-align: center;" {{!}} [[Image:{{{image<noinclude>|Placeholder.png</noinclude>}}}|220px]]
<!-- -->{{!}} colspan="2" style="text-align: center;" {{!}} [[Image:{{{image}}}|220px]]
}}
}}
|-
|-
{{#if:{{{type<includeonly>|</includeonly>}}}|
{{#if:{{{type|}}}{{{type1|}}}|
<!-- -->{{!}} style="vertical-align: top" {{!}} '''Type'''
<!-- -->{{!}} style="vertical-align: top" {{!}} '''Type'''
<!-- -->{{!}} {{#switch: {{lc: {{{type}}}}}
<!-- -->{{!}}{{#ifeq:{{{templatemode|}}}|nocats|{{Extension/TypeSwitch|_demomode_}}
|category=Category[[Category:Category extensions]]
|{{Foreach|Extension/TypeSwitch|delim=,|{{{type1|{{{type|missing}}}}}}|{{{type2|}}}|{{{type3|}}}|{{{type4|}}}|{{{type5|}}}|{{{type6|}}}}}}}
|database=Database[[Category:Database extensions]]
|{{Extension/TypeSwitch|_missing_}}
|db=Database[[Category:Database extensions]]
|data extraction=Data extraction[[Category:Data extraction extensions]]
|example=Example[[Category:Extension examples]]
|form=Form[[Category:Form extensions]]
|hook=Hook[[Category:Hook extensions]]
|interface=User interface[[Category:User interface extensions]]
|link=Link markup[[Category:Link markup extensions]]
|link, tag, special=Link markup, Tag, Special[[Category:Link markup extensions]][[Category:Tag extensions]][[Category:Special page extensions]]
|list=List[[Category:List extensions]]
|media=Media[[Category:Media handling extensions]]
|namespace=Namespace[[Category:Namespace extensions]]
|parser function=[[Extension:Parser function extensions|Parser function]][[Category:Parser function extensions]]
|parser function, special=Parser function, Special[[Category:Parser function extensions]][[Category:Special page extensions]]
|parser=Parser extension[[Category:Parser extensions]]
|pfunc=[[Extension:Parser function extensions|Parser function]][[Category:Parser function extensions]]
|search=Search[[Category:Search extensions]]
|extended syntax=Extended syntax[[Category:Extended syntax extensions]]
|special=Special page[[Category:Special page extensions]]
|special page=Special page[[Category:Special page extensions]]
|tag=Tag[[Category:Tag extensions]]
|tag, parser function=Tag, Parser function[[Category:Tag extensions]][[Category:Parser function extensions]]
|tag, special=Tag, Special[[Category:Tag extensions]][[Category:Special page extensions]]
|tag, parser function, special=Tag, Parser function, Special[[Category:Tag extensions]][[Category:Parser function extensions]][[Category:Special page extensions]]
|table=Table[[Category:Table extensions]]
|variable=Variable[[Category:Variable extensions]]
|parser,pfunc=[[Extension:Parser function extensions|Parser function]][[Category:Parser function extensions]] and parser extension[[Category:Parser extensions]]
|parser, hook, special=Parser extension[[Category:Parser extensions]], hook[[Category:Hook extensions]], and special page[[Category:Special page extensions]]
|{{{type}}}<includeonly>[[Category:Extensions with invalid or missing type]]</includeonly>}}
}}
}}
|-
|-
| style="vertical-align: top" | '''Description''' || {{{description}}}
| style="vertical-align: top" | '''Description''' || {{{description}}}
|-
|-
{{#if:{{{author|{{{username<includeonly>|</includeonly>}}}}}}|
{{#if:{{{author|{{{username|}}}}}}|
<!-- -->{{!}} style="vertical-align: top" {{!}} '''Author(s)'''
<!-- -->{{!}} style="vertical-align: top" {{!}} '''Author(s)'''
<!-- -->{{!}} {{#if: {{{username|}}} | {{#ifeq: {{{username}}}|{{{author|{{{username}}}}}}||{{{author}}} (}}[[User:{{{username}}}|{{{username}}}]] <sup><small>[[User talk:{{{username}}}|talk]]</small></sup>{{#ifeq: {{{username}}}|{{{author|{{{username}}}}}}||)}} | {{{author}}} }}
<!-- -->{{!}} {{#if: {{{username|}}} | {{#ifeq: {{{username}}}|{{{author|{{{username}}}}}}||{{{author}}} (}}[[User:{{{username}}}|{{{username}}}]] <sup><small>[[User talk:{{{username}}}|talk]]</small></sup>{{#ifeq: {{{username}}}|{{{author|{{{username}}}}}}||)}} | {{{author}}} }}
}}
}}
|-
|-
{{#if:{{{version<includeonly>|</includeonly>}}}|
{{#if:{{{version|}}}|
<!-- -->{{!}} style="vertical-align: top" {{!}} '''Version'''
<!-- -->{{!}} style="vertical-align: top" {{!}} '''Version'''
<!-- -->{{!}} {{{version}}}{{#if:{{{update|}}}|&#160;({{{update}}})}}
<!-- -->{{!}} {{{version}}}{{#if:{{{update|}}}|&#160;({{{update}}})}}
}}
}}
|-
|-
{{#if:{{{mediawiki<includeonly>|</includeonly>}}}|
{{#if:{{{mediawiki|}}}|
<!-- -->{{!}} style="vertical-align: top" {{!}} '''MediaWiki'''
<!-- -->{{!}} style="vertical-align: top" {{!}} '''MediaWiki'''
<!-- -->{{!}} {{{mediawiki}}}
<!-- -->{{!}} {{{mediawiki}}}
}}
}}
|-
|-
| style="vertical-align: top" | '''Download''' || {{{download<includeonly>|''no link''</includeonly>}}}{{#if:{{{readme|}}}|<br />{{{readme}}}}}{{#if:{{{changelog|}}}|<br />{{{changelog}}}}}
| style="vertical-align: top" | '''Download'''  
| {{#if:{{{download|}}}|{{{download}}}|''no link''}}{{#if:{{{readme|}}}|<br />{{{readme}}}}}{{#if:{{{changelog|}}}|<br />{{{changelog}}}}}
|-
|-
{{#if:{{{parameters<includeonly>|</includeonly>}}}|
{{#if:{{{parameters|}}}|
<!-- -->{{!}} style="vertical-align: top" {{!}} '''Parameters'''
<!-- -->{{!}} style="vertical-align: top" {{!}} '''Parameters'''
<!-- -->{{!}} {{{parameters}}}
<!-- -->{{!}} {{{parameters}}}
}}
}}
|-
|-
{{#if:{{{rights<includeonly>|</includeonly>}}}|
{{#if:{{{rights|}}}|
<!-- -->{{!}} style="vertical-align: top" {{!}} '''Added rights'''
<!-- -->{{!}} style="vertical-align: top" {{!}} '''Added rights'''
<!-- -->{{!}} {{{rights}}}
<!-- -->{{!}} {{{rights}}}
}}
}}
|-
|-
{{#if:{{{example<includeonly>|</includeonly>}}}|
{{#if:{{{example|}}}|
<!-- -->{{!}} style="vertical-align: top" {{!}} '''Example'''
<!-- -->{{!}} style="vertical-align: top" {{!}} '''Example'''
<!-- -->{{!}} {{{example}}}
<!-- -->{{!}} {{{example}}}
}}
}}
|}<includeonly>{{DEFAULTSORT:{{{name|{{PAGENAME}}}}}}}[[Category:All extensions]]</includeonly><noinclude>
<!--********** THIS IS WHERE THE TEMPLATE ENDS **********-->
<br clear="right" />
== Usage ==
{|
|
{|border="1"
|+ '''Parameters'''
|-
| '''name''' || '''name of the extension'''
|-
| '''status''' || '''current release status'''
One of:
* ''[[:Category:Unstable extensions|unstable]]'' (broken - do not use this extension)
* ''[[:Category:Experimental extensions|experimental]]'' (early stages of development, may change drastically.)
* ''[[:Category:Beta status extensions|beta]]'' (stable but not fully tested)
* ''[[:Category:Stable extensions|stable]]'' (stable version)
* ''[[:Category:Extensions with unknown status|unknown]]'' (default)
If the status is anything other than the above, it will be ignored and the default value of 'Unknown' will be displayed in the template instead.  In cases where the value is omitted, it will be categorised as [[:category:extensions with unknown status|unknown]].  In cases where the value is invalid, it will be placed in a [[:category:extensions with invalid status|special category]] so that the error can be caught and fixed.
|-
| '''type''' || '''type of extension'''
Can contain any value, but the following special values ensure proper categorisation:
* ''[[:Category:Category extensions|category]]'' - Category
* ''[[:Category:Database extensions|database]]'' (or ''db'') - Database
* ''[[:Category:Data extraction extensions|data extraction]]'' - Data extraction
* ''[[:Category:Extension examples|example]]'' - Not a real extension, but an example of how to write one
* ''[[:Category:Extended syntax extensions|extended syntax]]'' - Extensions that add non-standard wiki syntax (i.e. <em>not</em> [[Manual:Tag extensions|tags]], [[Manual:Parser functions|parser functions]], or [[Manual:Variables|variables]]).
* ''[[:Category:Form extensions|form]]'' - Form
* ''[[:Category:Hook extensions|hook]]'' - Hook extension (defines a <em>new</em> hook))
* ''[[:Category:User interface extensions|interface]]'' - User interface extension (e.g. [[w:javascript|javascript]] code)
* ''[[:Category:Link markup extensions|link]]'' - Link markup extensions
* ''link, tag, special'' - defines link markup extensions, [[Manual:Tag extensions|XML-like tags]] and [[Manual:Special pages|special pages]].
* ''[[:Category:List extensions|list]]'' - List
* ''[[:Category:Media handling extensions|media]]'' - Media
* ''[[:Category:Namespace extensions|namespace]]'' - Namespace
* ''[[:Category:Parser extensions|parser]]'' - Parser extension (uncategorized)
* ''[[:Category:Parser function extensions|pfunc]]'' (or ''parser function'') - Parser function
* ''parser function, special'' - defines [[Manual:Parser functions|parser functions]], and [[Manual:Special pages|special pages]].
* ''[[:Category:Special page extensions|special]]'' - [[Manual:Special pages|Special page]]
* ''[[:Category:Table extensions|table]]'' - Table
* ''[[:Category:Tag extensions|tag]]'' - [[Manual:Tag extensions|Tag extension]]
* ''tag, parser function'' - defines [[Manual:Tag extensions|XML-like tags]] and [[Manual:Parser functions|parser functions]].
* ''tag, special'' - defines [[Manual:Tag extensions|XML-like tags]] and [[Manual:Special pages|special pages]].
* ''tag, parser function, special'' - defines [[Manual:Tag extensions|XML-like tags]], [[Manual:Parser functions|parser functions]], and [[Manual:Special pages|special pages]].
* ''[[:Category:Variable extensions|variable]]'' - defines [[Manual:Variables|wiki variables]]
* ''parser,pfunc'' - available as parser function ''and'' as parser extension (places extension in both categories)
* ''parser, hook, special'' - Parser extension, hook, and special page (places extension in each category)
(Obviously, better template coding to allow multiple types without having to create separate syntax for all possible combinations is needed.) Any other value for 'type' is invalid, and will cause the extension to be placed in [[:Category:Extensions with invalid or missing type]].
|-
| author    || The extension author's name, if different from their MediaWiki.org username. Free text. If omitted then the 'username' field will be used (if present).
|-
| username  || The author's username on MediaWiki.org (if they have one). May be omitted, but if present it will be used to link to the author's user & user_talk page.
|-
| image      || screenshot (of base 270px)
|-
| version    || last version
|-
| update    || date of the last update
|-
| mediawiki  || required version of MediaWiki
|-
| '''download''' || '''link to the download''' : [http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/ SVN] or other
|-
| readme    || link to the readme file : [http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/Sort/Sort README] or other
|-
| changelog  || link to the changelog file : [http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/Sort/Sort CHANGELOG] or other
|-
| '''description''' || '''short description'''
|-
| parameters || available parameters for LocalSettings.php
|-
| rights    || rights added by the extension. '''Not to be confused with the license!''' Rights are such as ''[[Extension:MakeBot|makebot]]'' or ''[[Extension:Desysop|desysop]]'', not such as GFDL or LGPL or GPL - those are licenses!
|-
| example    || example, website or screenshot of working extension
|}
|}
 
{{#ifeq:{{{templatemode|}}}|nocats||{{DEFAULTSORT:{{{name|{{PAGENAME}}}}}}}[[Category:All extensions]]}}</includeonly><noinclude>
== Using the infobox ==
[[Category:Info templates|{{PAGENAME}}]]
=== Existing extension pages ===
[[Category:Extension creation]]
If you want to add the infobox to an existing page, copy and paste the following code and add it to the top:
[[Category:Categorizing templates|{{PAGENAME}}]]
 
<nowiki>{{Extension
|name        =
|status      =
|type        =
|author      =
|username    =
|image      =
|version    =
|update      =
|mediawiki  =
|download    =
|readme      =
|changelog  =
|description =
|parameters  =
|rights      =
|example    =
}}</nowiki>
 
=== Create a new extension article ===
If you want to create a new extension page, enter the name below and click the button. A new page will be created with the infobox template already in place.
 
<inputbox>
type=create
bgcolor=#eeeeff
width=40
default=Extension:MyExtension
preload=Template_Extension_Sample
buttonlabel=Create a new Extension (replace "MyExtension" with the correct name)
</inputbox>
[[Category:Info templates|{{PAGENAME}}]][[Category:Extension creation]]
[[Category:Categorizing templates]]
</noinclude>
</noinclude>

Revision as of 11:48, 8 September 2007