Modulo:Software: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
+d:P577 ridondante |
disattivo categorie al di fuori del NS0 |
||
(18 versioni intermedie di 7 utenti non mostrate) | |||
Riga 15:
local UNKNOWN_WD_LICENSE = ""
local UNKNOWN_WD_TOOLKIT = "[[Categoria:Toolkit o framework dell'interfaccia grafica non previsto]]"
local TEMPLATE_UNKNOWN_ARG_WARN = " <span style=\"font-size:75%\">(non in [[Template:Software#Linguaggi|lista]])</span>"
Line 29 ⟶ 30:
-------------------------------- Sgabuzzino ------------------------------------
--[[▼
local function rawProperty(property)▼
* Get the ID from a statement (claim) of type wikibase-id
*▼
* @param table Wikibase claim
* @return string|nil
]]▼
return claim.mainsnak.datavalue and claim.mainsnak.datavalue.value.id
end
--[[
* @param string
* @TODO ora prende il primo, a prescindere dalla lingua (credo).
* @return string
Line 72 ⟶ 79:
* Poi non ditemi che PHP fa schifo. asd.
* Sembra che l'operatore "#" ogni tanto non vada col Modulo:Wikidata.
* 00:28, 28 feb
]]
local function count(t)
Line 114 ⟶ 121:
error("Questa non è una categoria, o è assente la proprietà Wikidata P301")
end
return
end
Line 128 ⟶ 135:
local colon = man and ':' or ''
return "[[" .. colon .. "Categoria:" .. string.format(category, part) .. "]]"
end▼
▲--[[
▲*
▲]]
▲ return free and '[[Categoria:Software libero senza linguaggio]]' or '[[Categoria:Software senza linguaggio]]'
end
Line 163 ⟶ 161:
function p.hasAProprietaryLicense(frame)
return yesNoNil( p._hasAProprietaryLicense( fromItem(frame) ) )
▲end
function p.languageCategories( frame )
return p._languageCategories( fromItem( frame ) )
end
Line 178 ⟶ 180:
function p.wikidataCategoriesFromMainTopic(frame)
local s = p._wikidataCategories( fromItemMainTopic() )
return s .. string.format('[[Categoria:
end
Line 222 ⟶ 224:
]]
function p.yearsCategories(frame)
return p._yearsCategories( fromItem(frame), onlySoftwareArguments(frame).DataPrimaVersione )
end
Line 251 ⟶ 253:
-- Il template non mostra alcun linguaggio?
local noLanguages = not tl_has and not wd_languages
local outputLanguages = {} -- {key = {label1, category1}, key = {label2, category2}}
Line 260 ⟶ 262:
if wd_languages then
for i, language in pairs(wd_languages) do
local languageId =
if languageId then
outputLanguages[languageId] = outputLanguage(
shortWikidataLabel(languageId),
language and p._languageCategory(language, is_free)
)
improved = true
else▼
end
end
Line 278 ⟶ 277:
if tl_has then
-- Wikidata ha migliorato il template e il template aveva già altri valori
s = s .. '[[Categoria:
else
-- Wikidata ha migliorato il template che era vuoto
s = s .. '[[Categoria:
end
else
if p._templateHasExtraInformations(args) or count(tl_languages) > count(wd_languages) then
-- Nel template c'è qualcosa in più rispetto a Wikidata
s = s .. '[[Categoria:
elseif count(wd_languages) ~= 0 then
-- Non ha migliorato niente perchè sono gli stessi valori
s = s .. '[[Categoria:
end
end
Line 296 ⟶ 295:
if tl_has and nszero then
-- solo se il template specifica linguaggi ma Wikidata no
s = s .. '[[Categoria:
end
end
Line 349 ⟶ 348:
s = s .. UNKNOWN_WD_LANGUAGE
end
if noLanguages and is_free then
s = s ..
end
end
Line 358 ⟶ 357:
function p.manLanguages(frame)
local s = '<table class="wikitable"><tr><th>Parametro</th><th>Risultato</th><th>Categoria automatica</th></tr>'
local TD = '<td>%s</td>'
for id, language in pairs( conf.language ) do
Line 387 ⟶ 386:
]]
function p._categorize(args)
local ns = mw.title.getCurrentTitle().namespace
local v = args['Categorie']
if v then▼
▲ return mw.ustring.lower(v) ~= 'no'
end
Line 491 ⟶ 488:
]]
function p._specifiesALanguage(args)
return p._templateHasLanguages(args) or mWikidata.
end
Line 550 ⟶ 547:
--[[
* Questa licenza è direttamente identificabile?
*
* @TODO: Rewrite in qualche modo più umano.
*
* @param license string Wikidata item
Line 555 ⟶ 554:
]]
function p._singleLicenseType(license)
--
--
-- Q3943414 free software license
-- Q31202214 proprietary software license
-- Q218616 proprietary software
-- Q3238057 proprietary license!
--[[
Line 564 ⟶ 565:
* le prossime tre righe riassumino l'*unica* parte piacevole del Lua.
]]
return (license == 'Q3943414' or license == 'Q5975031' or license ==
or (license == '
or UNKNOWN
end
Line 683 ⟶ 684:
--[[
* Ha un certo tipo di licenza?
*
* Per motivi di performance dal 29 luglio 2017 si cerca solo fino alla prima licenza identificabile.
*
* @param type FREE|PROPRIETARY|UNKNOWN
Line 690 ⟶ 693:
function p._hasALicenseOfType(type, from)
for _, l in pairs( p._licenses(from) ) do
l =
if
local retrievedType = p._licenseType(l)
if type ~= UNKNOWN then
return type == retrievedType
end
end
Line 699 ⟶ 705:
--[[
* La voce
*
* @param from string|nil Wikidata item
Line 709 ⟶ 715:
--[[
* La voce
*
* @param from string|nil Wikidata item
Line 727 ⟶ 733:
local s = ''
for i, l in pairs( p._licenses( from ) ) do
local id =
local name = conf.licenseCategory[ id ]
if name then
local cat = conf.licenseCategoryShorter[id] and LICENSE_CAT_SHORTER or LICENSE_CAT
Line 752 ⟶ 758:
if languages then
for _, l in pairs( languages ) do
l = conf.language[
if l then
s = s .. p._languageCategory(l, free)
Line 759 ⟶ 765:
end
end
s =
end
if missing then
Line 781 ⟶ 787:
if toolkits then
for _, t in pairs( toolkits ) do
t = conf.language[
if t then
s = s .. p._languageCategory(t, free)
Line 825 ⟶ 831:
]]
function p._yearsCategories(from, value)
local mCategoryByYear = require('Modulo:Categoria per anno')._main
local
if '' ==
return mCategoryByYear
end
return mCategoryByYear
end
|