Modulo:Software: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m local count
+p.hasAFreeLicense +p.hasAProprietaryLicense
Riga 62:
end
 
local function p.isFreeSoftwarebool2human(framev)
if isv == nil then
local is = p._isFreeSoftware(frame)
if is == nil then
return nil
end
return isv and 'sì' or 'no'
end
 
function p.isFreeSoftware(frame)
localreturn is =bool2human( p._isFreeSoftware(frame) )
end
 
Riga 171 ⟶ 174:
end
return i
end
 
-- Cache
local licenses_ = false
function p.licenses(frame)
if licenses_ == false then
-- Property:P275 license
licenses_ = mWikidata._getClaims('P275')
end
return licenses_
end
 
-- Cache
local licenseIsFree_ = {}
function p._licenseIsFree(license)
if licenseIsFree_[license] == nil then
-- Q3943414 free software license
licenseIsFree_[license] = p._instanceOf({'Q3943414', from = license}) or false
end
return licenseIsFree_[license]
end
 
-- Cache
local licenseIsProprietary_ = {}
function p._licenseIsProprietary(license)
if licenseIsProprietary_[license] == nil then
-- Q725920 end-user license agreement
licenseIsProprietary_[license] = p._instanceOf({'Q725920', from = license}) or false
end
return licenseIsProprietary_[license]
end
 
--[[
* La voce ha almeno una licenza di software libero?
]]
function p._hasAFreeLicense(frame)
for _, license in p.licenses(frame) do
if p._licenseIsFree(license) then
return true
end
end
return false
end
 
--[[
* La voce ha almeno una licenza di software proprietario?
]]
function p._hasAProprietaryLicense(frame)
for _, license in p.licenses(frame) do
if p._licenseIsProprietary(license) then
return true
end
end
return false
end
 
function p.hasAFreeLicense(frame)
return bool2human( p._hasAFreeLicense(frame) )
end
 
function p.hasAProprietaryLicense(frame)
return bool2human( p._hasAProprietaryLicense(frame) )
end