local export = {}
local us = mw.ustring
function export.ko_attest(frame)
local parent_args = frame:getParent().args
local args = require("Module:parameters").process(parent_args, {
= {type = "language", required = true, etym_lang = true},
= {},
= {},
= {},
= {},
= {type = "number"},
= {alias_of = "header"},
= {default = "first"},
= {alias_of = "work"},
= {},
= {},
= {alias_of = "work_hanja"},
= {},
= {alias_of = "year"},
= {type = "number"},
= {},
= {}, -- TODO: support multiple pages
= {},
})
local headers = {
= "First ] as ",
= "Also ] as ",
= "In the ] script, first ] as ",
= "In the ] script, first ] as ",
= "",
}
local header = headers]
local hapaxes = {
= "] ",
= "] ",
= "] ",
= "] "
}
local hapax = (args and {hapaxes]} or {""})
if hapax == nil then
error("hapax= must be unspecified or between 1 and 4, inclusive")
end
local attest = args:makeWikipediaLink() .. " " .. hapax .. require("Module:links").full_link({
term = args,
lang = args,
gloss = args,
tr = args,
alt = args,
})
local attest_work = ""
if args then
if not args then
error("work= was supplied, so year= must be supplied")
end
local ko = require("Module:languages").getByCode("ko")
local work_tr
if args then
work_tr = args
else
work_tr = ko:transliterate(us.gsub(args, "_", " "))
work_tr = us.upper(us.sub(work_tr, 1, 1)) .. us.sub(work_tr, 2, -1)
end
local work = us.gsub(args, "_", "")
if args then
work = args .. " / " .. work
end
local work_tagged = require("Module:script utilities").tag_text(work, ko)
local position = ""
if args and args then
position = " " .. args .. ":" .. args
elseif args then
position = " " .. args
elseif args then
position = " " .. args
end
local link = ""
if args then
link = "<sup> .. "]</sup>"
end
attest_work = " in the ''" .. work_tr .. "'' (" .. work_tagged .. ")" .. position .. link .. ", " .. args
end
return header .. attest .. attest_work
end
return export