Knowledge

Template:Yesno

Source 📝

21: 98: 52: 541:
For the named parameters, use of a blank value is not the same as omitting the parameter. A blank named parameter tells the template that the customized return value is blank. For example:
329:) unless an explicit positive value is given; i.e., it evaluates to "no" even when the value is present, as long as it does not contain anything that resolves to "yes". 139:
or nil output, based on the content of the input and several configurable options. It is not used in article prose, but in coding complex templates.
1397: 1299:
Specifies the output of the template when the input value is defined but is either empty or contains nothing but whitespace character(s)
1408: 1393: 1381: 36: 113: 289:
By default, the template returns "yes" in the first and last case but returns nil (blank, empty string) in the other cases.
1345:
Specifies the output of the template when the input value is defined but not a form of 'yes', 'no', '1', '0', '¬' or blank
1420: 1377: 32: 1363: 64: 1322:
Specifies the output of the template when the input value is either '¬' (negation) or entirely missing (undefined)
1276:
Specifies the output of the template when the input value is a case-insensitive forms of 'No', 'N', 'False, or '0'
1253:
Specifies the output of the template when the input value is a case-insensitive forms of 'Yes', 'Y', 'True' or '1'
1176: 311:) unless an explicit negative value is given; i.e., it evaluates to "yes" even when the value is empty or missing. 1436: 1036:
Unnamed parameter 1= the input value to be evaluated. The other parameters (all named, all optional), are the
40: 1168: 59: 1403: 147:
The template distinguishes five different types of input, supplied on the first unnamed parameter:
105: 76: 1388: 1172: 1164: 109: 83:. The tested changes can be added to this page in a single edit. Please discuss changes on the 80: 72: 223: 71:
To avoid major disruption and server load, any changes should be tested in the template's
8: 84: 1416: 1371: 1139: 895: 298: 252: 28: 338:
Template's default output can be customized with five named parameters, respectively:
292:
Two short-hand templates for the most common uses that override the default behavior:
1367: 1149: 906: 316: 533:|purple monkey dish washer|def=cup of tea|yes=bacon}} 1430: 1144:– variant of Yesno that defaults to "yes" if value is not explicitly negative 1154:– variant of Yesno that defaults to "no" if value is not explicitly positive 1132: 15: 358:. If these parameters are specified, the template response is as follows: 69:
Changes to it can cause immediate changes to the Knowledge user interface.
1040:
for their respective logical outcome. When set, each one overrules their
222:: When the input is defined but either contains no value or consists of 65:
approximately 9,060,000 pages, or roughly 15% of all pages
249: 513:|purple monkey dish washer|def=cup of tea}} 307:– always returns "yes" (or the specified replacement result in 325:– always returns "no" (or the specified replacement result in 1193:
This template normalises an input to be a yes or nil output.
523:|purple monkey dish washer|yes=bacon}} 560:|purple monkey dish washer|def=}} 505:
in absence of the former; otherwise, returns "yes".
437:
in absence of the former; otherwise, returns blank.
1428: 135:) evaluates any input and produces a normalized 1183:in articles based on its TemplateData. 550:|purple monkey dish washer}} 283:|Purple monkey dish washer}} 1387:Editors can experiment in this template's 18: 333: 479:, otherwise returns blank. For example: 465:|blank=eggs|no=ham}} 401:, otherwise returns blank. For example: 369:, otherwise returns "yes". For example: 568: 1429: 1031: 1177:See a monthly parameter usage report 104:This template can only be edited by 92: 46: 497:: Template returns the contents of 475:: Template returns the contents of 429:: Template returns the contents of 397:: Template returns the contents of 365:: Template returns the contents of 13: 869:Comparison with related templates 487:|¬|¬=sausage}} 387:|y|yes=bacon}} 14: 1448: 1353: 1330: 1307: 1284: 1261: 1238: 377:|y|yes=Yeah}} 305:{{YesNo-Yes}} 323:{{YesNo-No}} 96: 50: 19: 1158: 419:|n|no=ham}} 409:|n|no=Nay}} 1: 133:{{YesNo}} 445:|blank=eggs}} 255:) or entirely missing; i.e. 188:: Case-insensitive forms of 154:: Case-insensitive forms of 7: 1107: 587:and their associated texts 244:: When the input is either 60:MediaWiki:Protectedpagetext 10: 1453: 1361: 1167:for this template used by 1421:Subpages of this template 1230:The value to be evaluated 1204: 875: 868: 846: 841: 818: 813: 783: 778: 746: 741: 732:* Case-insensitive (N=n) 717: 712: 684: 678: 667:* Case-insensitive (Y=y) 653: 647: 634: 630: 626: 622: 618: 597: 575: 87:before implementing them. 79:subpages, or in your own 58:This template is used in 455:|no=ham}} 236:| }} 142: 535:results in "cup of tea" 515:results in "cup of tea" 1437:If-then-else templates 1415:Add categories to the 1186:TemplateData for Yesno 334:Customizing the output 24:Template documentation 1290:Output on blank input 1083:Output on blank input 616:Return text when set: 606:Logical return value 180:|yEs}} 1042:default return value 569:Logical distinctions 489:results in "sausage" 224:whitespace character 214:|nO}} 1359: 1201: 1199:Template parameters 1032:Full parameter list 874:Input parameter 1 ( 679:{{yesno|Some Text}} 261:|¬}} 1372:Template:Yesno/doc 1197: 1195: 1190: 525:results in "bacon" 389:results in "bacon" 1358: 1357: 1217: 1191: 1175:and other tools. 1029: 1028: 946:no, n, false, 0* 916:yes, y, true, 1* 864: 863: 709:no, n, false, 0* 654:yes by definition 644:yes, y, true, 1* 467:results in "eggs" 447:results in "eggs" 379:results in "Yeah" 121: 120: 114:cascade-protected 112:onto one or more 91: 90: 1444: 1412: 1401: 1385: 1341: 1318: 1295: 1272: 1249: 1226: 1218: 1202: 1196: 1153: 1143: 1128: 1124: 1121: 1118: 1116: 1102: 1098: 1093: 1089: 1084: 1080: 1075: 1071: 1066: 1062: 1057: 1052: 932: 911: 905: 900: 894: 889: 883: 877: 866: 865: 848: 843: 820: 815: 805: 804: 785: 780: 768: 767: 748: 743: 719: 718:no by definition 714: 704: 703: 686: 681: 680: 674: 656: 655: 649: 636: 632: 628: 624: 620: 599: 583: 573: 572: 561: 552:results in "yes" 551: 534: 524: 514: 504: 500: 488: 478: 466: 457:results in "ham" 456: 446: 436: 432: 431:|blank= 421:results in "ham" 420: 411:results in "Nay" 410: 400: 388: 378: 368: 357: 353: 349: 348:|blank= 345: 341: 328: 324: 320: 310: 306: 302: 284: 270: 262: 247: 237: 229: 215: 207: 203: 199: 195: 191: 181: 173: 169: 165: 161: 157: 138: 134: 130: 100: 99: 93: 54: 53: 47: 44: 25: 23: 22: 1452: 1451: 1447: 1446: 1445: 1443: 1442: 1441: 1427: 1426: 1425: 1424: 1414: 1406: 1391: 1386: 1375: 1360: 1339: 1336:Definite output 1316: 1293: 1270: 1247: 1224: 1189: 1161: 1147: 1137: 1126: 1122: 1119: 1114: 1113: 1110: 1105: 1103: 1101:Definite output 1100: 1096: 1094: 1091: 1087: 1085: 1082: 1078: 1076: 1073: 1069: 1067: 1064: 1060: 1058: 1055: 1053: 1048: 1034: 1019: 1014: 1002: 986: 981: 968: 963: 951: 930: 909: 903: 898: 892: 887: 881: 853: 838: 825: 803: 800: 799: 790: 775: 766: 763: 762: 753: 738: 724: 702: 699: 698: 677: 672: 652: 633: 629: 625: 621: 617: 610: 595: 593: 577: 571: 564: 555: 545: 528: 518: 508: 502: 498: 482: 476: 460: 450: 440: 434: 430: 414: 404: 398: 382: 372: 366: 355: 351: 347: 343: 339: 336: 326: 322: 314: 308: 304: 296: 278: 264: 256: 245: 231: 227: 209: 205: 201: 197: 193: 189: 175: 171: 167: 163: 159: 155: 145: 136: 132: 124: 123: 117: 97: 70: 68: 51: 45: 26: 20: 12: 11: 5: 1450: 1440: 1439: 1356: 1355: 1352: 1349: 1348: 1342: 1337: 1333: 1332: 1329: 1326: 1325: 1319: 1314: 1310: 1309: 1306: 1303: 1302: 1296: 1291: 1287: 1286: 1283: 1280: 1279: 1273: 1268: 1264: 1263: 1260: 1257: 1256: 1250: 1245: 1241: 1240: 1237: 1234: 1233: 1227: 1222: 1216: 1215: 1212: 1209: 1206: 1181:Template:Yesno 1169:TemplateWizard 1162: 1160: 1157: 1156: 1155: 1145: 1135: 1130: 1109: 1106: 1046: 1033: 1030: 1027: 1026: 1023: 1020: 1018: 1015: 1013: 1010: 1009: 1006: 1003: 1001: 998: 994: 993: 990: 987: 985: 982: 980: 976: 975: 972: 969: 967: 964: 962: 959: 958: 955: 952: 950: 947: 943: 942: 939: 936: 933: 927: 926: 923: 920: 917: 913: 912: 901: 890: 879: 871: 870: 862: 861: 859: 856: 854: 852: 849: 844: 839: 837: 834: 833: 831: 828: 826: 824: 821: 816: 811: 807: 806: 802: 796: 793: 791: 789: 786: 781: 776: 774: 770: 769: 765: 759: 756: 754: 752: 749: 744: 739: 737: 734: 733: 730: 727: 725: 723: 720: 715: 710: 706: 705: 701: 695: 692: 690: 687: 685:yes by default 682: 675: 669: 668: 665: 662: 660: 657: 650: 645: 641: 640: 637: 614: 612: 607: 604: 601: 589: 588: 585:logical values 570: 567: 566: 565: 563: 562:results in "" 553: 539: 538: 537: 536: 526: 516: 503:|yes= 499:|def= 492: 491: 490: 470: 469: 468: 458: 448: 424: 423: 422: 412: 392: 391: 390: 380: 367:|yes= 356:|def= 340:|yes= 335: 332: 331: 330: 312: 309:|yes= 287: 286: 272: 239: 217: 183: 144: 141: 119: 118: 108:because it is 106:administrators 103: 101: 89: 88: 55: 17: 16: 9: 6: 4: 3: 2: 1449: 1438: 1435: 1434: 1432: 1422: 1418: 1410: 1405: 1399: 1395: 1390: 1383: 1379: 1373: 1369: 1365: 1364:documentation 1350: 1347: 1346: 1343: 1338: 1335: 1334: 1327: 1324: 1323: 1320: 1315: 1312: 1311: 1304: 1301: 1300: 1297: 1292: 1289: 1288: 1281: 1278: 1277: 1274: 1269: 1266: 1265: 1258: 1255: 1254: 1251: 1246: 1244:Output on yes 1243: 1242: 1235: 1232: 1231: 1228: 1223: 1220: 1219: 1213: 1210: 1207: 1203: 1200: 1194: 1188: 1187: 1182: 1178: 1174: 1170: 1166: 1151: 1146: 1141: 1136: 1134: 1131: 1112: 1111: 1065:Output on yes 1051: 1045: 1043: 1039: 1038:return values 1024: 1021: 1016: 1012: 1011: 1007: 1004: 999: 996: 995: 991: 988: 983: 978: 977: 973: 970: 965: 961: 960: 956: 953: 948: 945: 944: 940: 937: 934: 929: 928: 924: 921: 918: 915: 914: 908: 902: 897: 891: 886: 880: 873: 872: 867: 860: 857: 855: 850: 845: 840: 836: 835: 832: 829: 827: 822: 817: 812: 809: 808: 797: 794: 792: 787: 782: 777: 772: 771: 760: 757: 755: 750: 745: 740: 736: 735: 731: 728: 726: 721: 716: 711: 708: 707: 696: 693: 691: 688: 683: 676: 671: 670: 666: 663: 661: 658: 651: 648:{{yesno|yes}} 646: 643: 642: 638: 615: 613: 608: 605: 602: 591: 590: 586: 581: 574: 559: 554: 549: 544: 543: 542: 532: 527: 522: 517: 512: 507: 506: 496: 495:Anything else 493: 486: 481: 480: 474: 471: 464: 459: 454: 449: 444: 439: 438: 435:|no= 428: 425: 418: 413: 408: 403: 402: 399:|no= 396: 393: 386: 381: 376: 371: 370: 364: 361: 360: 359: 344:|no= 327:|no= 318: 313: 300: 295: 294: 293: 290: 282: 276: 275:Anything else 273: 268: 260: 254: 251: 243: 240: 235: 225: 221: 218: 213: 187: 184: 179: 153: 150: 149: 148: 140: 128: 115: 111: 107: 102: 95: 94: 86: 82: 78: 74: 66: 62: 61: 56: 49: 48: 42: 38: 34: 30: 1344: 1321: 1298: 1275: 1267:Output on no 1252: 1229: 1198: 1192: 1185: 1184: 1180: 1173:VisualEditor 1165:TemplateData 1163:This is the 1159:TemplateData 1152:}} 1148:{{ 1142:}} 1138:{{ 1133:Module:yesno 1104:}} 1074:Output on no 1049: 1047:{{ 1041: 1037: 1035: 910:}} 904:{{ 899:}} 893:{{ 888:}} 884: 882:{{ 858:"Undefined" 830:"Undefined" 779:{{yesno|1=}} 713:{{yesno|no}} 611:return text 584: 582:}} 579: 578:{{ 576:Overview of 557: 556:{{ 547: 546:{{ 540: 530: 529:{{ 520: 519:{{ 510: 509:{{ 494: 484: 483:{{ 477:|¬= 472: 462: 461:{{ 452: 451:{{ 442: 441:{{ 426: 416: 415:{{ 406: 405:{{ 394: 384: 383:{{ 374: 373:{{ 362: 352:|¬= 337: 319:}} 315:{{ 301:}} 297:{{ 291: 288: 280: 279:{{ 274: 269:}} 266: 265:{{ 258: 257:{{ 241: 233: 232:{{ 219: 211: 210:{{ 185: 177: 176:{{ 151: 146: 129:}} 126: 125:{{ 122: 81:user subpage 57: 1368:transcluded 1313:Output on ¬ 1221:Input value 1208:Description 1092:Output on ¬ 1056:Input value 814:{{yesno|¬}} 798:"Neg" when 761:"Neg" when 697:"Pos" when 631:¬=Undefined 627:blank=Blank 594:parameter 1 285:→ yes 226:only; i.e. 182:→ yes 110:transcluded 39:] [ 35:] [ 31:] [ 1362:The above 742:{{yesno|}} 228:{{Yesno|}} 77:/testcases 1419:subpage. 1404:testcases 1239:suggested 1205:Parameter 1140:Yesno-yes 1127:¬ 931:Some Text 896:yesno-yes 842:{{yesno}} 673:Some Text 299:yesno-yes 85:talk page 63:, and on 1431:Category 1354:optional 1331:optional 1308:optional 1285:optional 1262:optional 1150:Yesno-no 1123:NOT SIGN 1108:See also 907:yesno-no 795:"Blank" 758:"Blank" 603:In code 501:, or of 473:Negation 433:, or of 317:yesno-no 250:alt code 242:Negation 73:/sandbox 1396:| 1389:sandbox 1382:history 1380:| 1095:| 1086:| 1077:| 1068:| 1059:| 1054:| 635:def=Def 619:yes=Pos 609:Default 427:Nothing 277:: e.g. 271:→ 238:→ 220:Nothing 216:→ 208:; e.g. 174:; e.g. 37:history 1413:pages. 1351:String 1328:String 1305:String 1282:String 1259:String 1236:String 1214:Status 1120:¬ 1117: 1115:U+00AC 1099:= 1090:= 1081:= 1072:= 1063:= 1022:"yes" 1005:"yes" 989:"yes" 971:"yes" 938:"yes" 935:"yes" 925:"yes" 922:"yes" 919:"yes" 801:blank= 764:blank= 729:"Neg" 694:"Def" 689:"yes" 664:"Pos" 659:"yes" 623:no=Neg 204:, and 170:, and 116:pages. 1370:from 1294:blank 1079:blank 1050:yesno 1025:"no" 1008:"no" 992:"no" 974:"no" 957:"no" 954:"no" 941:"no" 885:yesno 784:blank 747:blank 639:Note 592:Input 580:yesno 558:yesno 548:yesno 531:yesno 521:yesno 511:yesno 485:yesno 463:yesno 453:yesno 443:yesno 417:yesno 407:yesno 385:yesno 375:yesno 281:Yesno 267:Yesno 259:Yesno 234:Yesno 212:Yesno 198:false 178:Yesno 143:Usage 127:Yesno 43:] 41:purge 27:[ 1417:/doc 1409:edit 1402:and 1398:diff 1394:edit 1378:edit 1211:Type 1179:for 700:def= 354:and 164:true 131:(or 33:edit 29:view 1366:is 1340:def 1248:yes 1097:def 1061:yes 1017:"" 1000:"" 984:"" 966:"" 949:"" 851:"" 823:"" 788:"" 751:"" 722:"" 363:Yes 321:or 303:or 263:or 253:170 230:or 202:off 156:Yes 152:Yes 137:yes 75:or 1433:: 1374:. 1271:no 1171:, 1070:no 1044:. 997:¬ 979:1= 878:) 876:1= 810:¬ 773:1= 600:) 598:1= 395:No 350:, 346:, 342:, 200:, 196:, 192:, 190:No 186:No 168:on 166:, 162:, 158:, 1423:. 1411:) 1407:( 1400:) 1392:( 1384:) 1376:( 1317:¬ 1225:1 1129:) 1125:( 1088:¬ 847:¬ 819:¬ 596:( 248:( 246:¬ 206:0 194:n 172:1 160:y 67:.

Index

view
edit
history
purge
MediaWiki:Protectedpagetext
approximately 9,060,000 pages, or roughly 15% of all pages
/sandbox
/testcases
user subpage
talk page
administrators
transcluded
cascade-protected
Yesno
Yesno
Yesno
whitespace character
Yesno
alt code
170
Yesno
Yesno
Yesno
yesno-yes
yesno-no
yesno
yesno
yesno
yesno
yesno

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.