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, default = "und"},
= {},
= {},
= {},
= {},
= {type = "number"},
= {alias_of = "header"},
= {default = "first"},
= {type = "boolean"},
= {alias_of = "work"},
= {},
= {},
= {type = "boolean"},
= {alias_of = "work_hanja"},
= {},
= {alias_of = "year"},
= {},
= {},
= {},
= {},
})
local headers = {
= "First ]",
= "Also ]",
= "In the ] script, first ]",
= "In the ] script, first ]",
= "",
}
local header = headers]
if args then
header = us.lower(us.sub(header, 1, 1)) .. us.sub(header, 2, -1)
end
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
if args == "-" then
attest = ""
else
if args == "" then
require('Module:debug/track')("ko-attest/missing attested form")
end
attest = (header == "" and " " or " as ") .. args:makeWikipediaLink() .. " " .. hapax .. require("Module:links").full_link({
term = args,
lang = args,
gloss = args,
tr = args,
alt = args,
})
end
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
local delim_left = args and "“" or "''"
local delim_right = args and "”" or "''"
attest_work = " in the " .. delim_left .. work_tr .. delim_right .. " (" .. work_tagged .. ")" .. position .. link .. ", " .. args
else
require('Module:debug/track')("ko-attest/missing work")
end
return header .. attest .. attest_work
end
return export