Moduuli:Sitaatti
Greedopedia, Tähtien sota -huumoriwiki, jossa on yli 582 967 853 artikkelia
Siirry navigaatioonSiirry hakuunTämän moduulin ohjeistuksen voi tehdä sivulle Moduuli:Sitaatti/ohje
-- [[Malline:Sitaatti]]
local p = {}
function p._main(args)
-- Create the surrounding div.
local root = mw.html.create('div')
root
:addClass('quote')
-- Start a new line and add the span containing the quote.
root
:newline()
:wikitext(':')
local quoteSpan = root:tag('span')
if args[3] then
quoteSpan:attr('title', 'Lähde: ' .. args[3])
end
quoteSpan
:wikitext(string.format(
"%s''%s''%s",
args.noquote and '' or '”',
args[1] or '{{{1}}}',
args.trans and '' or '”'
))
-- Add the attribution.
root
:newline()
:wikitext(':―')
:wikitext(args[2] or '{{{2}}}')
-- Add everything that needs to go inside a noprint span.
if args['ääni'] or args.url or args[3] then
local noprintSpan = root:tag('span'):addClass('noprint')
-- Audio link
if args['ääni'] then
if args.fi then
noprintSpan
:wikitext(' — [[Tiedosto:Gnome-speakernotes.png|20px|(ääni)|link=]]')
:wikitext(string.format(
'[[Media:%s|Kuuntele]] <small>([[:Tiedosto:%s|kuvaus]])</small>',
args['ääni'], args['ääni']
))
else
noprintSpan
:wikitext(' — [[Tiedosto:Gnome-speakernotes.png|20px|(ääni)|link=]]')
:wikitext(string.format(
'[[Media:%s|Kuuntele]] <span style="color:dimgray">(englanniksi)</span> <small>([[:Tiedosto:%s|kuvaus]])</small>',
args['ääni'], args['ääni']
))
end
end
-- Source link
if args.url or args[3] then
local sourceSup = noprintSpan:tag('sup')
local display = mw.text.nowiki('[lähde]')
if args.url then
sourceSup
:addClass('plainlinks')
:wikitext(string.format('[%s %s]', args.url, display))
else
-- We have already checked that args[3] is present.
sourceSup:wikitext(string.format('[[%s|%s]]', args[3], display))
end
end
end
return tostring(root)
end
function p.main(frame)
local args = {}
for k, v in pairs(frame:getParent().args) do
v = v:match('^%s*(.-)%s*$') -- trim whitespace
if v ~= '' then
args[k] = v
end
end
return p._main(args)
end
return p