模組:War-headword
外观
local export = {}
local pos_functions = {}
local lang = require("Module:languages").getByCode("war")
local PAGENAME = mw.title.getCurrentTitle().text
local script = lang:findBestScript(PAGENAME) -- Latn
function export.show(frame)
local tracking_categories = {}
local args = frame:getParent().args
local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
local head = {} -- supports multiple headword
if args["head"] or args[1] then table.insert(head, args["head"] or args[1]) end
if args["head2"] or args[2] then table.insert(head, args["head2"] or args[2]) end
if args["head3"] or args[3] then table.insert(head, args["head3"] or args[3]) end
local data = {lang = lang, sc = script, pos_category = poscat, categories = {}, heads = head, translits = {"-"}, inflections = {}}
if pos_functions[poscat] then
pos_functions[poscat](args, data)
end
local content = mw.title.new(PAGENAME):getContent()
local code = content and mw.ustring.match(content, "{{war%-IPA[^}]*}}")
--Categorize words without [[Template:war-IPA]]
if script:getCode() == "Latn" and not code then
table.insert(tracking_categories, "沒有war-IPA模板的瓦瑞瓦瑞語詞")
end
return require("Module:headword").full_headword(data) .. require("Module:utilities").format_categories(tracking_categories, lang)
end
pos_functions["動詞"] = function(args, data)
params = {
[1] = {alias_of = 'head'},
[2] = {alias_of = 'real'}, --realis aspect
[3] = {alias_of = 'imp'}, --imperative
head = {list = true},
head2= {},
head3= {},
real = {list = true},
imp = {list = true},
dim = {list = true},
caus = {list = true},
freq = {list = true},
}
local args = require("Module:parameters").process(args,params)
data.heads = args.head
data.id = args.id
local pattern = args.pattern
args.real.label = "已然式"
args.imp.label = "命令式"
args.dim.label = "指小詞"
args.caus.label = "使役態"
args.freq.label = "反覆態"
args.real.accel = {form = "realis"}
args.imp.accel = {form = "imperative"}
if #args.real > 0 then table.insert(data.inflections, args.real) end
if #args.imp > 0 then table.insert(data.inflections, args.imp) end
if #args.dim > 0 then table.insert(data.inflections, args.dim) end
if #args.caus > 0 then table.insert(data.inflections, args.caus) end
if #args.freq > 0 then table.insert(data.inflections, args.freq) end
end
pos_functions["形容詞"] = function(args, data)
params = {
[1] = {alias_of = 'head'},
[2] = {alias_of = 'sup'},
head = {list = true},
head2= {},
head3= {},
sup = {list = true},
caus = {list = true},
dim = {list = true}
}
local args = require("Module:parameters").process(args,params)
data.heads = args.head
data.id = args.id
local pattern = args.pattern
args.sup.label = "最高級"
args.caus.label = "使役態"
args.dim.label = "指小詞"
args.sup.accel = {form = "superlative"}
if #args.sup > 0 then table.insert(data.inflections, args.sup) end
if #args.caus > 0 then table.insert(data.inflections, args.caus) end
if #args.dim > 0 then table.insert(data.inflections, args.dim) end
end
pos_functions["名詞"] = function(args, data)
params = {
[1] = {alias_of = 'head'},
[2] = {alias_of = 'pl'}, -- Special plural cases only
head = {list = true},
head2= {},
head3= {},
pl = {list =true},
dim = {list = true}
}
local args = require("Module:parameters").process(args,params)
data.heads = args.head
data.id = args.id
local pattern = args.pattern
args.pl.label = "複數"
args.dim.label = "指小詞"
args.pl.accel = {form = "plural"}
if #args.pl > 0 then table.insert(data.inflections, args.pl) end
if #args.dim > 0 then table.insert(data.inflections, args.dim) end
end
return export