Modulo:Collegamenti esterni: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
correggo cid come da discussione
riscrivo e correggo la generazione degli elenchi delle proprietà, vedi segnalazione
Riga 566:
local res = {}
local cfg = readConfig()
local wdLinkformatString = string.format('<tr><td>[[d:PropertyP:%s|%s (%s)]]</td><td>%s</td><td>%s</td><td>%s</td></tr>',
table.sort(orderedGroupNames)
for _, groupName in ipairs(orderedGroupNames) do
local wdLinks = {}
for _, linkConf in ipairs(cfg[groupName]) do
local templates = {}
local wdLink = string.format('<tr><td>[[d:Property:%s|%s (%s)]]</td><td>%s</td><td>%s</td><td>%s</td></tr>',
for template in string.gmatch(linkConf.template or '', '[^,]+') do
linkConf.pid, mWikidata._getLabel({ linkConf.pid }), linkConf.pid, linkConf.url or '', linkConf.cid or '', linkConf.template and ('[[t:'..linkConf.template..'|'..linkConf.template..']]') or '')
table.insert(wdLinkstemplates, wdLink)'[[t:' .. template .. '|' .. template .. ']]')
}end
local wdLink = string.format(formatString,
linkConf.pid,
mWikidata._getLabel({ linkConf.pid }),
linkConf.pid,
linkConf.url or '',
linkConf.cid or '',
table.concat(templates, ', '))
table.insert(wdLinks, wdLink)
end
 
local group = frame.args[1] == 'modulo' and
local group
string.format('* [[Modulo:Collegamenti esterni/%s]] (%s)', groupName, #wdLinks) or
local group =if frame.args[1] == 'modulo' andthen
mw.getCurrentFrame():expandTemplate {
group = string.format('* [[Modulo:Collegamenti esterni/%s]] (%s)', groupName, #wdLinks) or
groupName, #wdLinks)
else
local wikitable = mw.html.create('table')
titololocal title = string.format('[[Modulo:Collegamenti esterni/%s|%s]] (%s)', groupName, groupName, #wdLinks),
groupName, groupName, #wdLinks)
wikitable
:addClass('wikitable sortable plainlinks')
:tag('tr')
:tag('th'):wikitext('Proprietà')
:tag('th'):wikitext('Formato URL')
:tag('th'):wikitext('cid')
:tag('th'):wikitext('Template equivalenti')
:allDone()
:wikitext(table.concat(wdLinks))
group = mw.getCurrentFrame():expandTemplate {
title = 'Cassetto',
args = { titolo = title, testo = tostring(wikitable) }
titolo = string.format('[[Modulo:Collegamenti esterni/%s|%s]] (%s)', groupName, groupName, #wdLinks),
testo = '<table class="wikitable sortable plainlinks"><tr><th>Proprietà</th><th>Formato URL</th><th>cid</th><th>Template singolo</th></tr>' .. table.concat(wdLinks, '') .. '</table>'
}
}
end
table.insert(res, group)
end