Module:kilta-headword: Difference between revisions

no edit summary
(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 edit summary
Line 19: Line 19:
local pl = {}
local pl = {}
if escape then
if escape then
pl = {escape}
pl = escape
elseif word:match("[kh]wa$") or word:match("a$") then
elseif word:match("[kh]wa$") or word:match("a$") then
pl = {sub(word, 1, -1) .. "úr"}
pl = {sub(word, 1, -1) .. "úr"}
Line 33: Line 33:


function export.show(frame)
function export.show(frame)
local args = frame:getParent().args
local word = args["w"] or mw.title.getCurrentTitle().text
local params = {
[1] = {},
[2] = {list = true},
["w"] = {default = PAGENAME},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local word = args["w"]
local pos = args[1]; local pl = args[2]
local pos = args[1]; local pl = args[2]
local data = {lang = lang, pos_category = deabb[pos], heads = {word}, categories = {}, inflections = {},}
local data = {lang = lang, pos_category = deabb[pos], heads = {word}, categories = {}, inflections = {},}
if pl == '-' then
if pl[1] == '-' then
if pos == "n" then
if pos == "n" then
table.insert(data.inflections, {label = glossary_link("uncountable")})
table.insert(data.inflections, {label = glossary_link("uncountable")})