This module implements the reference template {{R:it:GDLI}}
.
local export = {}
function export.show(frame)
local args = require("Module:parameters").process(frame:getParent().args, {
= { default = mw.title.getCurrentTitle().text },
= { alias_of = "head" },
= { }, = { alias_of = "num" },
= { }, = { alias_of = "volume" },
= { }, = { },
})
local volume = args.volume
if volume == nil then
error("Please specify volume.")
-- The two supplementary volumes are treated on the site as the 23rd and 25th volume respectively.
elseif volume == "sup2004" then
volume = 23
elseif volume == "sup2009" then
volume = 25
else
volume = tonumber(volume)
if volume == nil or volume > 21 then
error("Volume given is invalid.")
end
end
if args.page and args.pages then
error("You cannot specify both |page= and |pages=.")
end
if args.page == nil and args.pages == nil then
error("Please specify page.")
end
local page_index = string.match(args.page or args.pages, "^%d+")
if page_index == nil then
error("Page input is not valid.")
end
-- There is an offset between the url number and the actual page which changes for each volume.
page_index = page_index + ({
= 9, = 5, = 6,
= 7, = 7, = 7,
= 7, = 7, = 7,
= 7, = 8, = 7,
= 8, = 8, = 8,
= 7, = 8, = 7,
= 7, = 7, = 8,
= 18, = 0,
})
local output_args = {
title = "w:it:Grande dizionario della lingua italiana",
publisher = "UTET",
year = ({
= "1966", = "1962", = "1964",
= "1966", = "1968", = "1970",
= "1972", = "1973", = "1975",
= "1978", = "1981", = "1984",
= "1986", = "1988", = "1990",
= "1992", = "1994", = "1996",
= "1998", = "2000", = "2002",
= "2004", = "2009",
}),
page = args.page, pages = args.pages,
pageurl = "https://www.gdli.it/sala-lettura/vol/" .. volume .. "?seq=" .. page_index,
}
-- The argument <num> is to provide the disambiguating number for homographs.
if args.num then
output_args.entry = args.head .. "<sup>" .. args.num .. "</sup>"
else
output_args.entry = args.head
end
if volume == 23 then
output_args.volume_plain = "supplement 2004"
elseif volume == 25 then
output_args.volume_plain = "supplement 2009"
else
-- The manual "volume" to <volume_plain> is because the cite-book recognises the en dash
-- and renders "volumes" instead of the singular.
output_args.volume_plain = "volume " .. volume .. " ''" .. ({
= "a–balb", = "balc–cerr", = "cert–dag",
= "dah–duu", = "e–fin", = "fio–graul",
= "grav–ing", = "ini–libb", = "libe–med",
= "mee–moti", = "moto–orac", = "orad–pere",
= "perf–po", = "pra–py", = "q–ria",
= "rib–roba", = "robb–schi", = "scho–sik",
= "sil–sque", = "squi–tog", = "toi–z",
}) .. "''"
end
return frame:expandTemplate { title = "cite-book", args = output_args }
end
return export