66 624
contributi
(Modular SecBoxContent) |
m (MottoBoxes first iteration) |
||
Riga 343: | Riga 343: | ||
<hr /> | <hr /> | ||
]==] | ]==] | ||
end | |||
--- Listo of "motto" sentences (P104) for Template:BoxAvvisi | |||
-- | |||
-- @frame Info from MW session | |||
-- @return Wikitext to inject in template | |||
function p.MottoBoxes(frame) | |||
local Subject | |||
local Boxes = {} | |||
--Series | |||
if frame.args[1] ~= nil then | |||
--Function is called from unliked page | |||
Subject = mw.wikibase.getEntity(frame.args[1]) | |||
else | |||
Subject = mw.wikibase.getEntity() | |||
end | |||
for _, Motto in ipairs(Subject.claims["P104"]) do | |||
local Text | |||
local Author | |||
local Source | |||
Text = Motto.mainsnak.datavalue.value | |||
Author = Motto.qualifiers["P47"].datavalue.value.id | |||
Source = Motto.qualifiers["P58"].datavalue.value.id | |||
table.insert(Boxes, frame:expandTemplate{ title = 'quote', args = {Text = Text, Sign = Author, Source = Source} }) | |||
end | |||
return table.concat(Boxes, string.char(10)) | |||
end | end | ||