Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module talk:Yesno
(section)
Add languages
Page contents not supported in other languages.
Add topic
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
Add topic
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Render T as true as well? == I have seen some applications use T as an option for true as well. It might, therefore, be useful to have the letter T (t) represent a true value as well. <span style="border:1px solid maroon; padding:0 2px">[[User:CRwikiCA|<span style="font-family:'Courier';color:maroon">CRwikiCA</span>]] [[User talk:CRwikiCA|<i style="color:navy">talk</i>]]</span> 15:15, 14 April 2015 (UTC) ;Request {{edit protected|ans=y}} I request a change to the module to recognize T or t and F or f as true and false entries. This would make the full code the following: <syntaxhighlight lang="lua" line> -- Function allowing for consistent treatment of boolean-like wikitext input. -- It works similarly to the template {{yesno}}. return function (val, default) -- If your wiki uses non-ascii characters for any of "yes", "no", etc., you -- should replace "val:lower()" with "mw.ustring.lower(val)" in the -- following line. val = type(val) == 'string' and val:lower() or val if val == nil then return nil elseif val == true or val == 'yes' or val == 'y' or val == 'true' or val == 't' or tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or val == 'f' or tonumber(val) == 0 then return false else return default end end </syntaxhighlight> Where lines 15 and 23 are new compared to the current code. <span style="border:1px solid maroon; padding:0 2px">[[User:CRwikiCA|<span style="font-family:'Courier';color:maroon">CRwikiCA</span>]] [[User talk:CRwikiCA|<i style="color:navy">talk</i>]]</span> 18:17, 23 April 2015 (UTC) :No opposition, so {{done}} — Martin <small>([[User:MSGJ|MSGJ]] Β· [[User talk:MSGJ|talk]])</small> 10:43, 27 April 2015 (UTC) ::I would be interested to know cases where such "t/f" values may be encountered. I know that in command prompts we may encounter "y/n" choices. But I cannot recall having ever encountered "t/f". ::Refs [[phab:T137584|T137584]] (Β« Allow Scribunto code to add a category without changing output Β»), which would allow to know on what (and how many) pages these values are actually used. ::[[User:Od1n|Od1n]] ([[User talk:Od1n|talk]]) 00:05, 20 October 2024 (UTC)
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)