Modulo:CategoriaMusicale: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m più leggibile?
grassetto standard
 
(2 versioni intermedie di un altro utente non mostrate)
Riga 16:
verifica quali delle chiavi della tabella subject2wikilink
è presente all'inizio del titolo della categoria e la memorizza
questa funzione è chiamata sia da p.main che dal template,
tramite il codice {{#invoke:CategoriaMusicale|get_subject}}
]]
function p.get_subject()
Riga 27 ⟶ 29:
end
 
--[[
questa è la funzione principale che genera il wikicodice per il template,
da invocare con il codice {{#invoke:CategoriaMusicale|main|genere|link_genere}}
]]
function p.main(frame)
local args = frame.args
local genre = args.genere or args[1]
local forced_link = args.link_genere or args[2]
local subject = p.get_subject()
local text = ""
if subject then
text = "Questa categoria raggruppa voci su '''" .. subject2wikilink[subject] .. " [["
if forced_link ~= "" then text = text .. forced_link .. "|" end
text = text .. genre .. "]]'''.\n\n"
end
text = text .. "'''Categorie correlate:'''\n<div class=\"colonne_strette\">"
if subject == "Gruppi musicali" or subject == "Musicisti" or subject == "Cantanti" or subject == "Disc jockey" then
text = text .. string.format("\n* [[:Categoria:%s per nazionalità|%s per nazionalità]]", subject, subject)