<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://petitplanet.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AYesno</id>
	<title>Module:Yesno - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://petitplanet.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AYesno"/>
	<link rel="alternate" type="text/html" href="https://petitplanet.wiki/index.php?title=Module:Yesno&amp;action=history"/>
	<updated>2026-04-08T09:47:40Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://petitplanet.wiki/index.php?title=Module:Yesno&amp;diff=20&amp;oldid=prev</id>
		<title>Stevium: Created Module:Yesno</title>
		<link rel="alternate" type="text/html" href="https://petitplanet.wiki/index.php?title=Module:Yesno&amp;diff=20&amp;oldid=prev"/>
		<updated>2025-11-09T08:42:50Z</updated>

		<summary type="html">&lt;p&gt;Created Module:Yesno&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--  &amp;lt;nowiki&amp;gt;&lt;br /&gt;
-- Source: https://genshin-impact.fandom.com/wiki/Module:Yesno&lt;br /&gt;
--- Yesno module for processing of boolean-like wikitext input.&lt;br /&gt;
--  &lt;br /&gt;
--  It works similarly to the [[wikipedia:Template:Yesno|Yesno Wikipedia&lt;br /&gt;
--  template]]. This module is a consistent Lua interface for wikitext&lt;br /&gt;
--  input from templates.&lt;br /&gt;
--  &lt;br /&gt;
--  Wikitext markup used by MediaWiki templates only permit&lt;br /&gt;
--  string parameters like `&amp;quot;0&amp;quot;`, `&amp;quot;yes&amp;quot;`, `&amp;quot;no&amp;quot;` etc. As Lua&lt;br /&gt;
--  has a boolean primitive type, Yesno converts this&lt;br /&gt;
--  wikitext into boolean output for Lua to process.&lt;br /&gt;
--  &lt;br /&gt;
--  @script             yesno&lt;br /&gt;
--  @release            stable&lt;br /&gt;
--  @author             [[User:Dessamator|Dessamator]]&lt;br /&gt;
--  @attribution        [[wikipedia:User:ATDT|ATDT]]&lt;br /&gt;
--  @attribution        [[wikipedia:User:Mr. Stradivarius|Mr. Stradivarius]]&lt;br /&gt;
--  @attribution        [[wikipedia:Special:PageHistory/Module:Yesno|Other Wikipedia contributors]]&lt;br /&gt;
--  @see                [[wikipedia:Module:Yesno|Original module on&lt;br /&gt;
--                      Wikipedia]]&lt;br /&gt;
--  @see                [[Module:Yesno/testcases|Test cases for this&lt;br /&gt;
--                      module]]&lt;br /&gt;
--  @param              {?boolean|string} value Wikitext boolean-style&lt;br /&gt;
--                      or Lua boolean input.&lt;br /&gt;
--                       * Truthy wikitext input (`&amp;#039;yes&amp;#039;`, `&amp;#039;y&amp;#039;`, `&amp;#039;1&amp;#039;`,&lt;br /&gt;
--                      `&amp;#039;t&amp;#039;` or `&amp;#039;on&amp;#039;`) produces `true` as output.&lt;br /&gt;
--                       * The string representations of Lua&amp;#039;s true&lt;br /&gt;
--                      boolean value (`&amp;#039;true&amp;#039;`) also produces `true`.&lt;br /&gt;
--                       * Falsy wikitext input (`&amp;#039;no&amp;#039;`, `&amp;#039;n&amp;#039;`, `&amp;#039;0&amp;#039;`,&lt;br /&gt;
--                      `&amp;#039;f&amp;#039;` or `&amp;#039;off&amp;#039;`) produces `false` as output.&lt;br /&gt;
--                       * The string representation of Lua&amp;#039;s false&lt;br /&gt;
--                      boolean value (`&amp;#039;false&amp;#039;`) also produces `false`.&lt;br /&gt;
--                       * Localised text meaning `&amp;#039;yes&amp;#039;` or `&amp;#039;no&amp;#039;` also&lt;br /&gt;
--                      evaluate to `true` or `false` respectively.&lt;br /&gt;
--  @param[opt]         {?boolean|string} default Output to return if&lt;br /&gt;
--                      the Yesno `value` input is unrecognised.&lt;br /&gt;
--  @return             {?boolean} Boolean output corresponding to&lt;br /&gt;
--                      `val`:&lt;br /&gt;
--                       * The strings documented above produce a&lt;br /&gt;
--                      boolean value.&lt;br /&gt;
--                       * A `nil` value produces an output of `nil`.&lt;br /&gt;
--                      As this is falsy, additional logic may be needed&lt;br /&gt;
--                      to treat missing template parameters as truthy.&lt;br /&gt;
--                       * Unrecognised values return the `default`&lt;br /&gt;
--                      parameter. Blank strings are a key example&lt;br /&gt;
--                      of Yesno&amp;#039;s unrecognised values and can evaluate&lt;br /&gt;
--                      to `true` if there is a default value.&lt;br /&gt;
local lower = mw.ustring.lower&lt;br /&gt;
local msg = mw.message.new&lt;br /&gt;
&lt;br /&gt;
local yes = lower(msg(&amp;#039;htmlform-yes&amp;#039;):plain())&lt;br /&gt;
local no = lower(msg(&amp;#039;htmlform-no&amp;#039;):plain())&lt;br /&gt;
local en_yes = lower(msg(&amp;#039;htmlform-yes&amp;#039;):inLanguage(&amp;#039;en&amp;#039;):plain())&lt;br /&gt;
local en_no = lower(msg(&amp;#039;htmlform-no&amp;#039;):inLanguage(&amp;#039;en&amp;#039;):plain())&lt;br /&gt;
&lt;br /&gt;
return function(value, default)&lt;br /&gt;
    value = type(value) == &amp;#039;string&amp;#039; and lower(value) or value&lt;br /&gt;
&lt;br /&gt;
    if value == nil then&lt;br /&gt;
        return nil&lt;br /&gt;
&lt;br /&gt;
    elseif value == true&lt;br /&gt;
        or value == yes&lt;br /&gt;
        or value == en_yes&lt;br /&gt;
        or value == &amp;#039;y&amp;#039;&lt;br /&gt;
        or value == &amp;#039;true&amp;#039;&lt;br /&gt;
        or value == &amp;#039;t&amp;#039;&lt;br /&gt;
        or value == &amp;#039;on&amp;#039;&lt;br /&gt;
        or value == &amp;#039;enable&amp;#039;&lt;br /&gt;
        or tonumber(value) == 1&lt;br /&gt;
    then&lt;br /&gt;
        return true&lt;br /&gt;
&lt;br /&gt;
    elseif value == false&lt;br /&gt;
        or value == no&lt;br /&gt;
        or value == en_no&lt;br /&gt;
        or value == &amp;#039;n&amp;#039;&lt;br /&gt;
        or value == &amp;#039;false&amp;#039;&lt;br /&gt;
        or value == &amp;#039;f&amp;#039;&lt;br /&gt;
        or value == &amp;#039;off&amp;#039;&lt;br /&gt;
        or value == &amp;#039;disable&amp;#039;&lt;br /&gt;
        or tonumber(value) == 0&lt;br /&gt;
    then&lt;br /&gt;
        return false&lt;br /&gt;
&lt;br /&gt;
    else&lt;br /&gt;
        return default&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
--  &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Stevium</name></author>
	</entry>
</feed>