Frontierpedia:General disclaimer and Module:Yesno: Difference between pages

From Frontierpedia, the Microsoft Agent encyclopedia
(Difference between pages)
(FRONTIERPEDIA MAKES NO GUARANTEE OF VALIDITY)
 
en>Mr. Stradivarius
(removing code that's no longer used)
 
Line 1: Line 1:
local p = {}


<strong style="display: block; font-weight: normal; text-align: center; font-size: x-large; padding: 1em; text-transform: uppercase">Frontierpedia makes no guarantee of validity</strong>
function p.yesno(frame)
Frontierpedia is maintained by its users, moderators, and community. Information here is usually always accurate. However, in the event of a vandal on the wiki, information may not be accurate on the vandalized page. However, these vandalized pages are usually fixed up very quickly by the moderators and the community.


==Trademarks==
    -- defaults
Any of the trademarks, service marks, collective marks, design rights or similar rights that are mentioned, used or cited in the articles of Frontierpedia are the property of their respective owners. Their use here does not imply that you may use them for any purpose other than for the same or a similar informational use as contemplated by the original authors of these Frontierpedia articles. Unless otherwise stated Frontierpedia are neither endorsed by nor affiliated with any of the holders of any such rights and as such Frontierpedia cannot grant any rights to use any otherwise protected materials. Your use of any such or similar incorporeal property is at your own risk.
    local retvals = {
        yes  = "yes",
        no    = "",
        ["¬"] = ""
    }


==Jurisdiction and legality of content==
    -- Allow arguments to override defaults.
Publication of information found in Frontierpedia may be in violation of the laws of the country or jurisdiction from where you are viewing this information. The Frontierpedia database is stored on servers in the United States of America, and is maintained in reference to the protections afforded under local and federal law. Laws in your country or jurisdiction may not protect or allow the same kinds of speech or distribution. Frontierpedia does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain or use, reproduce or republish the information contained herein.
    -- 'any' tracks the presence of any arguments at all.
    local args = frame.args
    local any = false
    for k,v in pairs(args) do
        any = true
        retvals[k] = v
    end
    -- If there are no arguments, try and get them from the parent frame.
    if any == false then
        local pframe = frame:getParent()
        args = pframe.args
        for k,v in pairs(args) do
            retvals[k] = v
        end
    end   
 
    val = args[1]
 
    -- First deal with the case if val is nil or "¬", then deal with other cases.
    if val == nil or val == '¬' then
        return retvals['¬']
    end
 
    val = val:lower()          -- Make lowercase.
    val = val:match'^%s*(.*%S)' or ''  -- Trim whitespace.
 
    if val == '' then
        return retvals['blank'] or retvals['no']
    elseif val == 'n' or val == 'no'  or val == '0' then
        return retvals['no']
    elseif val == 'y' or val == 'yes' or val == '1' or retvals['def'] == nil then
        return retvals['yes']
    else
        return retvals['def']
    end
end
 
return p

Revision as of 10:29, 23 March 2013

Documentation for this module may be created at Module:Yesno/doc

local p = {}

function p.yesno(frame)

    -- defaults
    local retvals = {
        yes   = "yes",
        no    = "",
        ["¬"] = ""
    }

    -- Allow arguments to override defaults.
    -- 'any' tracks the presence of any arguments at all.
    local args = frame.args
    local any = false
    for k,v in pairs(args) do
        any = true
        retvals[k] = v
    end
    -- If there are no arguments, try and get them from the parent frame.
    if any == false then
        local pframe = frame:getParent()
        args = pframe.args
        for k,v in pairs(args) do
            retvals[k] = v
        end
    end    

    val = args[1]

    -- First deal with the case if val is nil or "¬", then deal with other cases.
    if val == nil or val == '¬' then
        return retvals['¬']
    end

    val = val:lower()          -- Make lowercase.
    val = val:match'^%s*(.*%S)' or ''  -- Trim whitespace.

    if val == '' then
        return retvals['blank'] or retvals['no']
    elseif val == 'n' or val == 'no'  or val == '0' then
        return retvals['no']
    elseif val == 'y' or val == 'yes' or val == '1' or retvals['def'] == nil then
        return retvals['yes']
    else
        return retvals['def']
    end
end

return p