Modulo:Software: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m isFreeSoftware(frame) return 'sì', 'no', nil
+_isFreeSoftwareByTemplate +_isFreeSoftwareByWikidata
Riga 4:
 
local p = {}
 
function p._isFreeSoftwareByTemplate(frame)
local isFreeSoftwareis = nil
local args = frame and getArgs(frame)
local localIsFreeSoftwarev = args['SoftwareLibero']
if v then
local yep = {['sì'] = true, ['si'] = true, ['no'] = false}
v = yep[ mw.ustring.lower(v) ]
end
return v
--end
 
function p._isFreeSoftwareByWikidata()
local wikidataIsProprietary =return mWikidata._instanceOf({'Q218616'})
end
 
function p._isProprietarySoftwareByWikidata()
local wikidataIsFreeSoftware =return mWikidata._instanceOf({'Q341', 'Q1130645'})
end
 
--[[
Line 11 ⟶ 30:
]]
function p._isFreeSoftware(frame)
local is_wd = p._isFreeSoftwareByWikidata()
local isFreeSoftware = nil
local argsisnt_wd = frame and getArgsp._isProprietarySoftwareByWikidata(frame)
local is_tp = p._isFreeSoftwareByTemplate(frame)
local localIsFreeSoftware = args['SoftwareLibero']
local is = nil
if localIsFreeSoftware then
if is_wd then
local yep = {['sì'] = true, ['si'] = true, ['no'] = false}
is = true
localIsFreeSoftware = mw.ustring.lower(localIsFreeSoftware)
localIsFreeSoftware = yep[localIsFreeSoftware]
end
local wikidataIsFreeSoftware = mWikidata._instanceOf({'Q341', 'Q1130645'})
local wikidataIsProprietary = mWikidata._instanceOf({'Q218616'})
if wikidataIsFreeSoftware ~= nil then
isFreeSoftware = wikidataIsFreeSoftware
end
if wikidataIsProprietary ~= nilisnt_wd then
is = false
--if isFreeSoftware then
-- No sense
--end
isFreeSoftware = not wikidataIsProprietary
end
if localIsFreeSoftwareis_tp ~= nil then
is = is_tp
isFreeSoftware = localIsFreeSoftware
end
 
return isFreeSoftware
--if is_wd == true and isnt_wd == true then
-- Wikidata nonsense
--end
 
--if is_wd == true and is_tp == true then
-- Local same as Wikidata
--
 
--if (is_wd == true and is_tp == false) or (isnt_wd == true and is_tp == false) then
-- Free different from Wikidata
--
 
--if (is_wd ~= nil or isnt_wd ~= nil) and is_tp == false then
-- Free/proprietary read from Wikidata
--
return is
end