66 514
contributi
mNessun oggetto della modifica |
Nessun oggetto della modifica |
||
(13 versioni intermedie di uno stesso utente non sono mostrate) | |||
Riga 11: | Riga 11: | ||
local SeasonsQty = require('Modulo:DTSem').SeasonsQty | local SeasonsQty = require('Modulo:DTSem').SeasonsQty | ||
local LabelOrLink = require('Modulo:DTBase').LabelOrLink | local LabelOrLink = require('Modulo:DTBase').LabelOrLink | ||
--local PropertiesOnTree = require('Modulo:DTFunzioniComuni').PropertiesOnTree | |||
local SeriesTree = require('Modulo:DTFunzioniComuni').SeriesTree | |||
--- generates a list of backlink using SMW query. | --- generates a list of backlink using SMW query. | ||
Riga 163: | Riga 165: | ||
local FinalString = "" | local FinalString = "" | ||
local Actor = mw.title.getCurrentTitle().text | local Actor = mw.title.getCurrentTitle().text | ||
local QueryResult = mw.smw.getQueryResult('[[Interprete::' .. Actor .. ']]|?' .. Actor .. '|sort=Numero di produzione|order=asc') | local QueryResult = mw.smw.getQueryResult('[[Interprete::' .. Actor .. ']]|?' .. Actor .. '|limit=500|sort=Numero di produzione|order=asc') | ||
if QueryResult == nil then | if QueryResult == nil then | ||
Riga 205: | Riga 207: | ||
-- @return Wikitext to inject in template | -- @return Wikitext to inject in template | ||
function p.SecBoxBuilder(frame) | function p.SecBoxBuilder(frame) | ||
local TemplateName | |||
local BoxTitle = "" | |||
local BoxContent = "" | |||
local SeriesQ | local SeriesQ | ||
local Short | local Short | ||
local CategoryNames = {} | local CategoryNames = {} | ||
Riga 221: | Riga 227: | ||
local Output = {} | local Output = {} | ||
--Series | -- Get page name and clean to get the name | ||
TemplateName = string.gsub(frame:getParent():getTitle(), "Template:", "") | |||
if TemplateName == "BoxSecEpisodio" then | |||
if mw.wikibase.getEntity().claims["P162"] ~= nil then | |||
BoxContent = BoxContent .. "<span class='titoletto'>Presentazione</span>" | |||
BoxContent = BoxContent .. "<p>" .. mw.wikibase.getEntity().claims["P162"][1].mainsnak.datavalue.value .. "</p>" | |||
end | |||
Series = SeriesTree(frame) | |||
BoxContent = BoxContent .. "<span class='titoletto'>Serie</span>" | |||
BoxContent = BoxContent .. Series | |||
BoxTitle = "Titolo BoxSecEpisodio" | |||
--BoxContent = "Contenuto BoxSecEpisodio<br />" .. Series | |||
else | |||
--Series | |||
if frame.args[1] ~= nil then | if frame.args[1] ~= nil then | ||
--Function is called from unliked page | --Function is called from unliked page | ||
Riga 228: | Riga 249: | ||
FullOutput = false | FullOutput = false | ||
elseif mw.wikibase.getEntity().claims["P14"][1].mainsnak.datavalue.value.id == "Q13" then | elseif mw.wikibase.getEntity().claims["P14"][1].mainsnak.datavalue.value.id == "Q13" then | ||
-- Page is instance of Series | |||
Series = mw.wikibase.getEntity() | Series = mw.wikibase.getEntity() | ||
elseif mw.wikibase.getEntity().claims["P16"] ~= nil then | elseif mw.wikibase.getEntity().claims["P16"] ~= nil then | ||
Series = mw.wikibase.getEntity(QFromP("P16")) | Series = mw.wikibase.getEntity(QFromP("P16")) | ||
else | else | ||
Series = "" | -- Fall back to Short Treks | ||
Series = mw.wikibase.getEntity("Q8537") | |||
end | end | ||
BoxTitle = "Titolo " .. TemplateName | |||
BoxContent = "Contenuto " .. TemplateName | |||
end | |||
--[=[ | --[=[ | ||
Riga 244: | Riga 274: | ||
}} | }} | ||
--]=] | --]=] | ||
return frame:expandTemplate{title = 'BoxSecondario', args = {Titolo = BoxTitle, Contenuto = BoxContent, Nome = TemplateName}} | |||
return frame:expandTemplate{title = 'BoxSecondario', args = {Titolo = | |||
end | end | ||
Riga 254: | Riga 283: | ||
function p.SecBoxSeries(frame) | function p.SecBoxSeries(frame) | ||
local SeriesQ | local SeriesQ | ||
local Series | local Series = "" | ||
local Short | local Short = "" | ||
local CategoryNames = {} | local CategoryNames = {} | ||
local UL | local UL | ||
Riga 276: | Riga 305: | ||
FullOutput = false | FullOutput = false | ||
elseif mw.wikibase.getEntity().claims["P14"][1].mainsnak.datavalue.value.id == "Q13" then | elseif mw.wikibase.getEntity().claims["P14"][1].mainsnak.datavalue.value.id == "Q13" then | ||
--Instance of the item is "Series" | |||
Series = mw.wikibase.getEntity() | Series = mw.wikibase.getEntity() | ||
elseif mw.wikibase.getEntity().claims["P16"] ~= nil then | |||
Series = mw.wikibase.getEntity(QFromP("P16")) | |||
else | else | ||
Series = mw.wikibase.getEntity(QFromP("P16" | --Episode | ||
Series = mw.wikibase.getEntity(mw.wikibase.getEntity(QFromP("P14")).claims["P16"][1].mainsnak.datavalue.value.id) | |||
end | end | ||
--Short name of the series | --Short name of the series | ||
--Short = mw.wikibase.getEntity(SeriesQ).claims['P24'][1].mainsnak.datavalue['value'] | --Short = mw.wikibase.getEntity(SeriesQ).claims['P24'][1].mainsnak.datavalue['value'] | ||
Riga 312: | Riga 346: | ||
Quantity = SeasonsQty(Short) | Quantity = SeasonsQty(Short) | ||
--mw.smw.set("Numero di stagioni = " .. | --mw.smw.set("Numero di stagioni = " .. Short) | ||
if Quantity < 1 then | if Quantity < 1 then | ||
Seasons = "Errore: <1" | Seasons = "Errore: <1" | ||
Riga 369: | Riga 403: | ||
--"fulltext": "Star Trek: Strange New Worlds", | --"fulltext": "Star Trek: Strange New Worlds", | ||
LI = mw.html.create('li') | LI = mw.html.create('li') | ||
LI:wikitext("[[" .. CurrSeries.fulltext .. "|" .. CurrSeries.printouts.Abbreviazione[1] .. "]]") | LI:wikitext("[[" .. (CurrSeries.fulltext or "NullFulltext") .. "|" .. (CurrSeries.printouts.Abbreviazione[1] or "NullAbbreviazione") .. "]]") | ||
UL:node(LI) | UL:node(LI) |