Template:Yesno/doc

From Survivalistsresource

(Difference between revisions)
m (count)
m (1 revision)
 

Current revision as of 09:00, 12 August 2011

{{#ifeq: yesno/doc | doc

 | 

{{

   #ifeq: show | show
   | {{
 {{#switch:
 {{#if: 
   | 
   | {{#if: 
     | 
       {{#ifeq:|
       | talk
       |  
       }}
     | 
       {{#ifeq:template|template talk
       | talk
       | template 
       }}
     }}
   }}

| main | = ambox | talk = tmbox | user = ombox | wikipedia = ombox | file | image = imbox | mediawiki = ombox | template = ombox | help = ombox | category = cmbox | portal = ombox | book = ombox | other | #default = ombox

}} | type = notice | image = File:Edit-copy green.svg | imageright = | style = | textstyle = | text = This is a documentation subpage for Template:Yesno/doc.
It contains usage information, categories, interlanguage links and other content that is not part of the original {{ #if: | {{{text2}}} | {{ #if: | {{{text1}}} | {{ #ifeq: Template | User | template template page | {{ #if: Template |template page|article}}}}}}}}. | small = | smallimage = | smallimageright = | smalltext = }}

   }}{{
   #if: 
   | 
   | [[Category:{{
     #if: Template
     | Template
     | Article
   }} documentation {{#ifeq:Template|Template|pages}}]]
 }}

| }} {{#ifeq:|yes

| {{#ifeq:{{#if:| {{{smallimage}}} | }}|none | | }}

{{#if:{{#if: | {{{smallimageright}}} | }} | {{#ifeq:{{#if: | {{{smallimageright}}} | }}|none

 | 
|
 }}

}}

{{#switch:content

| | speedy | delete | content | style | move | protection | notice =

| #default =
This message box is using an invalid "type=content" parameter and needs fixing.
[[Category:Wikipedia message box parameter needs fixing|Template:Main otherTemplate:Yesno/doc]]

}}

| {{#ifeq:|none | | }}

{{#if: | {{#ifeq:|none

 | 
|
 }}

}}

{{#switch:content

| | speedy | delete | content | style | move | protection | notice =

| #default =
This message box is using an invalid "type=content" parameter and needs fixing.
[[Category:Wikipedia message box parameter needs fixing|Template:Main otherTemplate:Yesno/doc]]

}} }}

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

[edit] 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.

[edit] See also

Personal tools