モジュール:kk-headword
このモジュールについての説明文ページを モジュール:kk-headword/doc に作成できます
local m_headword = require("モジュール:headword")
local m_utilities = require("モジュール:utilities")
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 = require("モジュール:scripts").findBestScript(PAGENAME, lang)
local tr = nil
-- Generate or retrieve the transliteration, depending on the script.
if sc == "Cyrl" then
local m_translit = require("モジュール:kk-translit")
tr = m_translit.tr(PAGENAME)
elseif sc == "Arab" then
tr = args["tr"]; if tr == "" then tr = nil end
end
local inflections = {}
local categories = {"カザフ語 " .. poscat}
if pos_functions[poscat] then
pos_functions[poscat](args, inflections, categories)
end
return m_headword.full_headword{
lang = lang,
heads = {head},
translit = {tr},
inflections = inflections,
categories = categories,
}
end
pos_functions["名詞"] = function(args, inflections, categories)
local plural = args["pl"]; if plural == "" then plural = nil end
if plural then
table.insert(inflections, {label = "複数主格", plural})
end
end
return export