This module implements the reference template {{R:sq:Bardhi:1635}}
.
local export = {}
function export.main(frame)
local args = require("Module:parameters").process(frame:getParent().args, {
= { list = true, allow_holes = true },
it = { list = true },
page = { list = true }, pages = { list = true, alias_of = "page" },
passage = { list = true, allow_holes = true },
etc = {},
})
local terms = args or {}
local term_it = args.it or {}
local pages = args.page or {}
local passages = args.passage or {}
local expand_args = {
worklang = "la,sq",
title = "Dictionarium Latino Epiroticum",
first = "Frang", last = "Bardhi", authorlink = "Frang Bardhi",
year = "1635",
}
local function get_pageurl(page)
return "https://books.google.com/?id=PJP7gP1p-JAC&pg=PA" .. string.match(page, "^%d+")
end
local additional = ""
if #pages == 0 then
expand_args.url = "https://books.google.com/?id=PJP7gP1p-JAC"
else
local format_link = require("Module:links").language_link
local get_lang = require("Module:languages").getByCode
local function get_passage(index)
if passages then return passages end
if not terms or not terms then
error("Content must be given for each page!")
end
local passage = format_link { term = terms, lang = get_lang("la") }
if term_it then
passage = passage .. ", " .. format_link { term = term_it, lang = get_lang("it") }
end
return passage .. " — " .. terms
end
if #pages == 1 then
expand_args.passage = get_passage(1)
expand_args.page = pages
expand_args.pageurl = get_pageurl(pages)
else
additional = ":"
for page_index, page in ipairs(pages) do
additional = additional
.. "\n** : “"
.. get_passage(page_index) .. "”"
end
if args.etc then
additional = additional .. "\n** etc."
end
end
end
return frame:expandTemplate { title = "cite-book", args = expand_args } .. additional
end
return export