local export = {}
function export.show(frame)
local list_with_holes = { list = true, allow_holes = true }
local params = {
= { alias_of = 'year' },
= { alias_of = 'author' },
= { alias_of = 'title' },
= list_with_holes,
= list_with_holes,
= list_with_holes,
= list_with_holes,
= list_with_holes,
= {},
= {},
= { alias_of = 'transtitle' },
= {},
= { alias_of = 'lang' },
= {},
= { default = 'book' },
= list_with_holes,
= list_with_holes,
= list_with_holes,
= list_with_holes,
= {},
= {},
= { alias_of = 'entry' },
= {},
= { alias_of = 'transentry' },
= { alias_of = 'transentry' },
= {},
= {},
= {},
= {},
= { alias_of = 'yearpublished' },
= {},
= {},
= {},
= {},
= {},
= {},
= {},
= {},
= list_with_holes,
= {},
= {},
= {},
= {},
= {},
= {},
= {},
= {},
= {},
= {},
= {},
= list_with_holes,
= {},
= {},
= {},
= {},
= {}
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local authors = {}
local authorlinks = {}
local contributors = {}
local authors_full, authorlinks, editors, translators, years, ids, pages =
args.author, args.authorlinks, args.editor, args.translator, args.year, args.id, args.page
local maxindex = math.max(args.last.maxindex, args.first.maxindex)
for index = 1, maxindex do
table.insert(authors, table.concat({args.last,args.first,args.author,args.authorlinks}, ", "));
end
for k,v in pairs(authors_full) do authors = v end
if args.coauthors then
table.insert(authors, args.coauthors)
end
local author, quotee, year, entry, chapter, contributor, title, series, language, version, volume, others, issue, edition, publisher, id, archive, section, page, passage = ""
if next(authors) ~= nil then
author = table.concat(authors, '</li><li>; </li></ul><ul class="cm-author"><li></li><li>')
author = '<ul class="cm-authors"><li></li><li><ul class="cm-author"><li></li><li>' .. author .. '</li><li></li></ul></li><li>, </li></ul>'
end
if args.quotee then
quotee = '<ul class="cm-quotee"><li>quoting </li><li>' .. args.quotee .. '</li><li> </li></ul>'
end
if next(years) ~= nil then
year = table.concat(years, '</li><li>, </li></ul><ul class="cm-year"><li></li><li>')
year = '<ul class="cm-years"><li>(</li><li><ul class="cm-year"><li></li><li>' .. year .. '</li><li></li></ul></li><li>), </li></ul>'
end
if args.entry and not args.chapter then
entry = args.entry
if args.url then
entry = ''
end
if args.transentry then
entry = entry .. '<ul class="cm-transentry"><li> </li></ul>'
end
entry = '<ul class="cm-entry"><li>"</li><li>' .. entry .. '</li><li>", in </li></ul>'
end
if args.chapter and not args.entry then
chapter = '<ul class="cm-chapter"><li>chapter </li><li>' .. args.chapter .. '</li><li>, in </li></ul>'
end
if next(contributors) ~= nil or next(translators) ~= nil or next(editors) ~= nil then
if next(translators) ~= nil then
contributor = table.concat(translators, '</li><li>; </li></ul><ul class="cm-translator"><li></li><li>')
contributor = '<ul class="cm-translators"><li></li><li><ul class="cm-translator"><li></li><li>' .. contributor .. '</li><li></li></ul></li><li>, transl., </li></ul>'
end
if next(editors) ~= nil then
contributor = contributor .. table.concat(editors, '</li><li>; </li></ul><ul class="cm-editor"><li></li><li>')
contributor = '<ul class="cm-editors"><li></li><li><ul class="cm-editor"><li></li><li>' .. contributor .. '</li><li></li></ul></li><li>, editor, </li></ul>'
end
if next(contributors) ~= nil then
contributor = contributor .. table.concat(contributors, '</li><li>; </li></ul><ul class="cm-contributor"><li></li><li>')
contributor = '<ul class="cm-contributors"><li></li><li><ul class="cm-contributor"><li></li><li>' ..contributor .. '</li><li></li></ul></li><li>, contributor, </li></ul>'
end
contributor = '<ul class="cm-contributors"><li></li><li>' .. contributor .. '</li><li></li></ul>'
end
if args.title then
title = args.title
if args.transtitle then
title = title .. '<ul class="cm-transtitle"><li> </li></ul>'
end
title = '<ul class="cm-title"><li></li><li>' .. title .. '</li><li> </li></ul>'
end
if args.series then
series = args.series
if args.seriesvolume then
series = series .. '<ul class="cm-seriesvolume"><li>; </li><li>' .. args.seriesvolume .. '</li><li></li></ul>'
end
series = '<ul class="cm-series"><li>(</li><li>' .. series .. '</li><li>), </li></ul>'
end
if args.lang then
local m_languages = require("Module:languages/code to canonical name")
language = m_languages or args.lang
language = '<ul class="cm-lang"><li>(in </li><li>' .. language .. '</li><li>), </li></ul>'
end
if args.version then
version = '<ul class="cm-version"><li>version </li><li>' .. args.version .. '</li><li>, </li></ul>'
end
if args.volume then
volume = '<ul class="cm-volume"><li>volume </li><li>' .. args.volume .. '</li><li>, </li></ul>'
end
if args.others then
others = '<ul class="cm-others"><li></li><li>' .. args.others .. '</li><li>, </li></ul>'
end
if args.issue then
issue = '<ul class="cm-issue"><li>issue </li><li>' .. args.issue .. '</li><li>, </li></ul>'
end
if args.edition then
edition = '<ul class="cm-edition"><li></li><li>' .. args.edition .. '</li><li> edition, </li></ul>'
end
if args.publisher then
publisher = args.publisher
if args.location then
publisher = '<ul class="cm-location"><li></li><li>' .. args.location .. '</li><li>: </li></ul>' .. publisher
end
if args.yearpublished then
publisher = publisher .. '<ul class="cm-yearpublished"><li>, published </li><li>' .. args.yearpublished .. '</li><li></li></ul>'
end
publisher = '<ul class="cm-publisher"><li></li><li>' .. publisher .. '</li><li>, </li></ul>'
end
if args.bibcode then
table.insert(ids, ']: ')
end
if args.doi then
table.insert(ids, ']: <ul class="neverexpand"></ul>')
end
if args.isbn then
table.insert(ids, frame:expandTemplate{title = 'ISBN', args = { args.isbn }})
end
if args.issn then
table.insert(ids, frame:expandTemplate{title = 'ISSN', args = { args.issn }})
end
if args.jstor then
table.insert(ids, '] ')
end
if args.lccn then
table.insert(ids, '] ')
end
if args.oclc then
table.insert(ids, '] ')
end
if args.pmid then
table.insert(ids, '] ')
end
if args.ssrn then
table.insert(ids, '] ')
end
if next(ids) ~= nil then
id = '<ul class="cm-id"><li></li><li>' .. table.concat(ids, '<span>, </span>') .. '</li><li></li>, </ul>'
end
if args.archiveurl and args.archivedate then
archive = '<ul class="cm-archiveurl"><li>archived from the </li><li></li><li></li></ul>'
archive = archive .. '<ul class="cm-archivedate"><li> on </li><li>' .. args.archivedate .. '</li><li></li></ul>'
archive = '<ul class="cm-archive"><li></li><li>' .. archive .. '</li><li>, </li></ul>'
end
if args.section then
section = '<ul class="cm-section"><li>section </li><li>' .. args.section .. '</li><li>, </li></ul>'
end
if next(pages) ~= nil then
page = table.concat(pages, ', ')
if args.column then
page = page .. '<ul class="cm-column"><li>, column </li><li>' .. args.column .. '</li><li></li></ul>'
end
page = '<ul class="cm-page"><li>pages </li><li>' .. page .. '</li><li></li></ul>'
end
if args.passage then
passage = args.passage
if args.translation then
passage = passage .. '<ul class="cm-translation"><li> </li></ul>'
end
if (args.blockquote or (#args.passage > 300)) and not args.noblockquote then
passage = '<ul class="cm-passage blockquote"><li>:</li><li>' .. passage .. '</li><li></li></ul>'
else
passage = '<ul class="cm-passage"><li>: “</li><li>' .. passage .. '</li><li>”</li></ul>'
end
end
local class = "cite-meta inline"
if next(authors) == nil then
class = class .. " no-author"
end
return '<div class="' .. class .. '">' .. require("Module:table").sparseConcat({author, quotee, year, entry, chapter, contributor, title, series, language, version, volume, others, issue, edition, publisher, id, archive, section, page, passage}) .. '</div>'
end
return export