Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Yesno: Difference between revisions

Template page
Making this template substable (sorry, job queue): Would be very usable to generalize input to some user talk page templates. Tested.
m 14 revisions from en:Template:Yesno
(No difference)

Revision as of 18:29, 29 May 2012

Template documentation[ view · edit · history · purge ]
This documentation is transcluded from Template:Yesno/doc.


This template normalises an input to be a yes/no output.

Usage

The template has five possible outputs depending on the default parameter (input if you will).

In its simplest usage these will all be either "yes" or "" (blank - nothing no characters).

  1. {{yesno|yes}} result "yes" (also applies to "Yes", "YeS", etc, "Y", "y" and "1")
  2. {{yesno|no}} result "" (also applies to "No", "NO", "nO", "N", "n" and "0")
  3. {{yesno}} result ""
  4. {{yesno|¬}} result ""
  5. {{yesno|purplemonkeydishwasher}} result "yes" (also applies to any other value not given above).


Each of these can be over-ridden.

  1. {{yesno|yes|yes=bacon}} result "bacon" (also applies to "Yes", "YeS", etc, "Y", "y" and "1")
  2. {{yesno|no|no=ham}} result "ham" (also applies to "No", "NO", "nO", "N", "n" and "0")
  3. {{yesno|blank= eggs}} result "eggs"
    1. but {{yesno|no=ham}} result "ham"
    2. and {{yesno|blank= eggs|no=ham}} result "eggs"
  4. {{yesno|¬|¬=sausage}} result "sausage"
  5. {{yesno|purplemonkeydishwasher|def=cup-of-tea}} result "cup-of-tea" (also applies to any other value not given above).
    1. but {{yesno|purplemonkeydishwasher|yes=bacon}} result "bacon"
    2. but {{yesno|purplemonkeydishwasher|def=cup-of-tea|yes=bacon}} result "cup-of-tea"

This may be used (apparently perversely) thus:

  • {{yesno|yes|yes=no|no=yes}} result "no"
  • {{yesno|no|yes=no|no=yes}} result "yes"

This creates a logical inversion.

TemplateData

<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

Normalizes boolean template arguments.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Input1

The value to normalize

Auto value
{{{parameter|¬}}}
Stringrequired
Truthy outputyes

Output on a truthy value (e.g.: case‑insensitive 'yes', 'y', 'true', or '1')

Default
yes
Stringoptional
Falsy outputno

Output on a falsy value (e.g.: case‑insensitive 'no', 'n', 'false', or '0')

Stringoptional
Blank outputblank

Output when the input parameter is defined but its value is empty

Default
{{{no}}}
Stringoptional
Undefined output¬

Output when the input parameter is either '¬' or entirely missing (undefined)

Auto value
¬
Stringoptional
Definite outputdef

Output when the input value is specified but isn't any of the preceding values

Default
{{{yes}}}
Stringoptional
Edit parameter translations
Cookies help us deliver our services. By using our services, you agree to our use of cookies.