Template:Iffile/doc: Difference between revisions

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Content deleted Content added
rmv, does not belong on /doc
add documentation for parameter 2, use TemplateData, Template:FNO now redirects here
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{heavily used template|3=+}}</includeonly>
{{TemplateBox
{{TemplateBox
|1=1
|1=1
|1label-en=file namespace
|1d={{Mld
|en=The wikitext to display if the test conclusive
|1d-en=The wikitext to display if the test is conclusive
|fr=Le wikitexte à afficher si le test est concluant
|1d-fr=Le wikitexte à afficher si le test est concluant
|1type=content
}}
|1def=
|1def=
|1stat=required
|1stat=required

|2=2
|2label-en=non-file namespace
|2d-en=The wikitext to display if the test isn’t conclusive
|2type=content
|2def=
|2stat=optional

|name=Iffile
|name=Iffile
|desc-en=Shorthand to display something only in the File namespace
|desc={{Mld
|desc-fr=Raccourci pour afficher quelque-chose seulement dans l’espace de nom Fichier
|en=Shorthand to display something only in the File namespaces
|fr=Raccourci pour afficher quelque-chose seulement dans l’espace de nom Fichier
}}
|namespace=all
|namespace=all
|usergroup=all
|usergroup=all
|placement=
|placement=
|usage-notes=Short for <code><nowiki>{{#ifeq:{{NAMESPACE}}|File|</nowiki></code>...<code><nowiki>}}</nowiki></code>.
|usage-notes=Short for <code><nowiki>{{#ifeq:{{NAMESPACE}}|File|</nowiki></code>...<code><nowiki>}}</nowiki></code>,<br>
{{0|Shortf}} or <code><nowiki>{{#ifeq:{{NAMESPACENUMBER}}|6|</nowiki></code>...<code><nowiki>}}</nowiki></code>.


Intended usage is for templates that should categorise only when used in File namespace.
Intended usage is for templates that should categorise only when used in File namespace.
Line 22: Line 30:
|i18n-method=-
|i18n-method=-
|i18n-desc=
|i18n-desc=
|seealso=*{{tl|Iffileorcategory}}
|seealso=
* {{tl|Iffileorcategory}}
* {{tl|FNO}}
* {{tl|Category}}
|setscats=
|setscats=
|lines=one
|lines=one
|shorthand=
|shorthand=
|relieson=
|relieson=
|useTemplateData=only
}}
}}
<includeonly>[[Category:Function templates|{{PAGENAME}}]]</includeonly>
<includeonly>[[Category:Function templates]]</includeonly>

Latest revision as of 20:36, 6 October 2022

Shorthand to display something only in the File namespace

Usage

{{Iffile |1= |2= }}

Short for {{#ifeq:{{NAMESPACE}}|File|...}},
Shortf or {{#ifeq:{{NAMESPACENUMBER}}|6|...}}.

Intended usage is for templates that should categorise only when used in File namespace.

Template parameters

<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.


Wikipedia's help about TemplateDataCommons-specific information

Shorthand to display something only in the File namespace

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
file namespace1

The wikitext to display if the test is conclusive

Contentrequired
non-file namespace2

The wikitext to display if the test isn’t conclusive

Contentoptional

Additional information

The template is intended to be used in the following namespaces: all namespaces

The template is intended to be used by the following user groups: all users

See also

Localization

This template is not intended to be localized.