Bu modulun sənədləşdirmə səhifəsi Modul:Citation/Render/doc səhifəsində yaradıla bilər
local p = {}
local date = require('Modul:Citation/Dates')
function p.author(args)
if args.author and args.author ~= '' then
return args.author .. '.'
end
return ''
end
function p.title(args)
if not args.title or args.title == '' then return '' end
local out = {}
if args.url and args.url ~= '' then
table.insert(out, string.format('[%s %s]', args.url, args.title))
else
table.insert(out, args.title)
end
local lang = args.language and mw.text.trim(args.language) or ''
if lang ~= '' then
local lower = lang:lower()
if lower ~= 'az' then
local tpl = mw.title.new('Şablon:ref-' .. lower)
if tpl and tpl.exists then
local langtext = mw.getCurrentFrame():expandTemplate{ title = 'ref-' .. lower }
out[#out] = out[#out] .. langtext
else
local langtext = string.format('<span class="ref-info" style="cursor:help;">(%s)</span>', lower)
out[#out] = out[#out] .. ' ' .. langtext
end
end
end
out[#out] = out[#out] .. '.'
return table.concat(out, ' ')
end
function p.website(args)
if args.work and args.work ~= '' then
return string.format(' <i>%s</i>.', args.work)
end
return ''
end
function p.dates(args)
local mainDate = ''
if args.date and args.date ~= '' then
mainDate = date.format(args.date, args.lang or 'az')
end
local archivePart = ''
if (args.archive_date and args.archive_date ~= '') or (args.archive_url and args.archive_url ~= '') then
archivePart = date.format(args.archive_date, args.lang or 'az', 'archive', args.archive_url)
end
local accessPart = ''
if args.access_date and args.access_date ~= '' then
accessPart = date.format(args.access_date, args.lang or 'az', 'access')
end
if (archivePart ~= '' or accessPart ~= '') then
local combined = ''
if archivePart ~= '' then
combined = archivePart
if accessPart ~= '' then
combined = combined .. '. ' .. accessPart
end
else
combined = accessPart
end
return mainDate .. ' (' .. mw.text.trim(combined) .. ')'
end
return mainDate
end
function p.render(args)
local parts = {}
if args.author and args.author ~= '' then
table.insert(parts, args.author .. '.')
end
if args.title and args.title ~= '' then
table.insert(parts, p.title(args))
end
if args.work and args.work ~= '' then
table.insert(parts, string.format(' <i>%s</i>.', args.work))
end
local datePart = p.dates(args)
if datePart and datePart ~= '' then
table.insert(parts, datePart)
end
return mw.text.trim(table.concat(parts, ' '))
end
return p