Module:kilta-headword: Difference between revisions
Jump to navigation
Jump to search
(Created page with "local match = mw.ustring.match local u = mw.ustring.char local gsub = mw.ustring.gsub local sub = mw.ustring.sub local TILDEB = u(0x0330) -- COMBINING TILDE BELOW ̰◌ local export = {} local lang = require("Module:languages").getByCode("kilta") local deabb = {["adj"] = "adjectives", ["v"] = "verbs", ["adv"] = "adverbs", ["n"] = "nouns"} local function glossary_link(entry, text) text = text or entry return "" .. text .. "...") |
(No difference)
|
Revision as of 17:41, 21 April 2024
Documentation for this module may be created at Module:kilta-headword/doc
local match = mw.ustring.match
local u = mw.ustring.char
local gsub = mw.ustring.gsub
local sub = mw.ustring.sub
local TILDEB = u(0x0330) -- COMBINING TILDE BELOW ̰◌
local export = {}
local lang = require("Module:languages").getByCode("kilta")
local deabb = {["adj"] = "adjectives", ["v"] = "verbs", ["adv"] = "adverbs", ["n"] = "nouns"}
local function glossary_link(entry, text)
text = text or entry
return "[[wikt:Appendix:Glossary#" .. entry .. "|" .. text .. "]]"
end
local function plural(word, escape)
local pl = {}
if escape then
pl = {escape}
elseif word:match("[kh]wa$") or word:match("a$") then
pl = {sub(word, 1, -1) .. "úr"}
elseif word:match("ës$") or word:match("uin$") or word:match("[str]$") then
pl = {word .. "á"}
elseif word:match("[nml]$") then
pl = {word .. "ur"}
end
pl.label = "plural"
return pl
end
function export.show(frame)
local args = frame:getParent().args
local word = args["w"] or mw.title.getCurrentTitle().text
local pos = args[1]; local pl = args[2]
local data = {lang = lang, pos_category = deabb[pos], heads = {word}, categories = {}, inflections = {},}
if pl == '-' then
if pos == "n" then
table.insert(data.inflections, {label = glossary_link("uncountable")})
table.insert(data.categories, lang:getCanonicalName() .. " uncountable " .. deabb[pos])
end
--[=[ elseif pos ~= "v" then
table.insert(data.inflections, {label = glossary_link("comparative"), redup(word)})
if pos == "adv" then table.insert(data.categories, lang:getCanonicalName() .. " comparative " .. deabb[pos]) end ]=]
else
table.insert(data.inflections, plural(word, pl))
end
return require('Module:headword').full_headword(data)
end
return export