Bu modulun sənədləşdirmə səhifəsi Modul:Mükafat/doc səhifəsində yaradıla bilər
-- Mükafat şablonları üçün ümumi modul
local p = {}
local mw = require('mw')
function p.render(frame)
local args = frame:getParent().args
local element = args['element'] or args['e'] or args[1] or ""
local file = args['fayl'] or args['file'] or ""
local size = args['ölçü'] or args['size'] or ""
local link = args['keçid'] or args['link'] or ""
local title = args['başlıq'] or args['title'] or ""
local category = args['kateqoriya'] or args['category'] or ""
local border = args['haşiyə'] or args['border'] or ""
local date = args['tarix'] or args['date'] or args[2] or ""
local image = file
local imageType = ""
if image == "" and element ~= "" then
local p2910 = mw.wikibase.getBestStatements(element, 'P2910')
local p2425 = mw.wikibase.getBestStatements(element, 'P2425')
if p2910 and #p2910 > 0 then
image = p2910[1].mainsnak.datavalue.value
imageType = "P2910"
border = "-"
elseif p2425 and #p2425 > 0 then
image = p2425[1].mainsnak.datavalue.value
imageType = "P2425"
end
end
if size == "" then
if imageType == "P2910" then
size = "x38px"
elseif imageType == "P2425" then
size = "x15px"
else
size = "x15px"
end
end
local wikilink = ""
if link ~= "" then
wikilink = link
elseif element ~= "" then
wikilink = mw.wikibase.getSitelink(element) or ("d:" .. element)
end
local label = title ~= "" and title or (link ~= "" and link or (element ~= "" and mw.wikibase.getLabelByLang(element, 'az') or ""))
if date ~= "" and image ~= "" then
label = label .. " — " .. date
end
local output = ""
if image ~= "" then
output = '[[Fayl:' .. image ..
(border ~= "-" and "|border" or "") ..
"|" .. size ..
(wikilink ~= "" and ("|link=" .. wikilink) or "") ..
(label ~= "" and "|" .. label or "") ..
']]'
else
output = '[[' .. wikilink .. '|' .. label .. ']]'
if date ~= "" then
output = output .. ' <span style="font-size:95%;">(' .. date .. ')</span>'
end
end
if element ~= "" then
output = '<span data-wikidata-value-id="' .. element .. '">' .. output .. '</span>'
end
if date ~= "" then
output = output .. '<span class="noprint" style="display:none" data-wikidata-qualifier-id="P585">' .. date .. '</span>'
end
if mw.title.getCurrentTitle().namespace == 0 then
if category ~= "" then
output = output .. '[[Kateqoriya:' .. category .. ']]'
elseif element ~= "" then
local cat = mw.wikibase.getBestStatements(element, 'P2517')
if cat and #cat > 0 then
local catQ = cat[1].mainsnak.datavalue.value
if type(catQ) == "table" then
catQ = catQ.id
end
local catSitelink = mw.wikibase.getSitelink(catQ)
if catSitelink and catSitelink ~= "" then
output = output .. '[[' .. catSitelink .. ']]'
end
end
end
end
return output
end
return p