模組:Kk-headword
外观
local export = {}
-- A list of functions that do the work that is specific to each part of speech.
local pos_functions = {}
local lang = require("Module:languages").getByCode("kk")
-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
local args = frame:getParent().args
PAGENAME = mw.title.getCurrentTitle().text
local head = args["head"]; if head == "" then head = nil end
-- The part of speech. This is also the name of the category that entries go in.
local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
-- Detect the script
local sc = lang:findBestScript(PAGENAME)
local tr = nil
-- Generate or retrieve the transliteration, depending on the script.
if sc == "Cyrl" then
local m_translit = require("Module:kk-translit")
tr = m_translit.tr(PAGENAME)
elseif sc == "Arab" then
tr = args["tr"]; if tr == "" then tr = nil end
end
local data = {lang = lang, sc = sc, pos_category = poscat, categories = {}, heads = {head}, translits = {tr}, inflections = {}}
if pos_functions[poscat] then
pos_functions[poscat](args, data)
end
return require("Module:headword").full_headword(data)
end
pos_functions["名詞"] = function(args, data)
local plural = args["pl"]; if plural == "" then plural = nil end
if plural then
table.insert(data.inflections, {label = "主格複數", plural})
end
end
return export