Modulo:Interprogetto/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
rifiniture |
use require('strict') instead of require('Module:No globals') |
||
(6 versioni intermedie di un altro utente non mostrate) | |||
Riga 1:
-- Modulo per implementare le funzionalità di template:Interprogetto
require('
local p = {} -- per l'esportazione delle funzioni del modulo
Riga 124:
if self.entity.claims and
self.entity.claims[property_id] and
self.entity.claims[property_id][1].mainsnak.datavalue and
self.entity.claims[property_id][1].mainsnak.datavalue.type == 'string' then
return self.entity.claims[property_id][1].mainsnak.datavalue.value
Line 134 ⟶ 135:
local interwiki = { project }
if property_language and self.entity.claims and self.entity.claims[property_language] then
project = project:sub(3)
for
if claim.mainsnak.datavalue.type == 'wikibase-entityid' then
local entityId = 'Q' .. claim.mainsnak.datavalue.value['numeric-id']
Line 141 ⟶ 143:
local language_code = claims[1] and claims[1].mainsnak.datavalue.value
if language_code then
end▼
table.insert(interwiki, language_code .. project)
self.lingua[language_code .. project] = language_code
end
end
Line 184 ⟶ 189:
self.collegamenti[key_progetto] = sitelink
end
if i == 1 and self.entity.sitelinks[interwiki].badges
local badge_class = {}
local badge_title = {}
Line 213 ⟶ 218:
function Wikidata_entity:hasPropertyValue(propertyId, values)
if self.entity.claims and self.entity.claims[propertyId] then
▲ if claim and claim.mainsnak and claim.mainsnak.datavalue and claim.mainsnak.datavalue.value then
local datavalue = claim.mainsnak.datavalue
if datavalue.type == 'wikibase-entityid'
▲ end
end
end
Line 286 ⟶ 285:
self.testo_dopo = ' <small>' .. args.data .. '</small>'
end
local lingua = key_progetto == 's_el' and 'lingua greca' or
entity.lingua[key_progetto] and require('Modulo:Linguaggi').get_voce(entity.lingua[key_progetto]) or args[key_progetto .. '_lingua'] and 'lingua ' .. args[key_progetto .. '_lingua']
if default_progetto.lingua and lingua then
Riga 400:
-- ============================================================================================================
-- Scandisce la tabella progetti e produce il codice html per l'elenco dei collegamenti nella barra di sinistra
-- Imposta il tag div id="interProject" (vedi accessorio [[MediaWiki:Gadget-InterProject
-- ============================================================================================================
local function RenderLeftBar(progetti)
local leftbar = mw.html.create('ul')
for _, progetto in ipairs(progetti) do
leftbar
:addClass(progetto.badge_leftbar.class)
if progetto.default_progetto.nome_leftbar then
leftbar:wikitext('<br />(', progetto.default_progetto.nome_progetto, ')')
end
end
root
:tag('div') :attr('id', 'interProject')
:
▲ :tag('p')
▲ :wikitext('Altri progetti')
:node(leftbar)
end
Line 553 ⟶ 546:
if entity.corsivo then
default.etichetta = '<span style=\"font-style:italic;\">' .. default.etichetta .. '</span>'
default.etichetta_lower =
end
end
Line 613 ⟶ 606:
end
-- ====================================================================================================
-- Aggiunge il collegamento da Wikidata se non è presente quello compilato manualmente o se rinvia a
-- un progetto in lingua non italiana che non è registrato nella configurazione e non va sovrascritto
-- ====================================================================================================
for key_progetto, collegamento in pairs(entity.collegamenti) do
if not
newArgs[key_progetto] = collegamento
-- Segnala che il collegamento è stato aggiunto da Wikidata
|