Module:qay-noun/head: Difference between revisions
Jump to navigation
Jump to search
(Created page with "local export = {} local m_p = require("Module:qay-noun") local m_d = require("Module:qay-noun/data") local PAGENAME = mw.title.getCurrentTitle().text local function detect_d...") |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 33: | Line 33: | ||
function export.pass_to_module(term, case, gender) | function export.pass_to_module(term, case, gender) | ||
local stem = | local stem = PAGENAME | ||
local data = {forms = {}, categories = {}} | local data = {forms = {}, categories = {}} | ||
local decl = gender .. "_" .. detect_decl( | local decl = gender .. "_" .. detect_decl(stem) | ||
stem = { | stem = {stem, "a"} | ||
if m_d[word] then m_d[word](stem, data) | if m_d[word] then m_d[word](stem, data) |
Latest revision as of 12:23, 25 June 2022
Documentation for this module may be created at Module:qay-noun/head/doc
local export = {}
local m_p = require("Module:qay-noun")
local m_d = require("Module:qay-noun/data")
local PAGENAME = mw.title.getCurrentTitle().text
local function detect_decl(word)
if word:match("[aeiouy]$") then
return "v"
else
return "c"
end
end
function export.generate(frame)
local case = frame.args[1]
local word = frame.args[2] == nil and nil or PAGENAME
local data = {forms = {}, categories = {}}
local decl = detect_decl(word)
local stem = word
stem = {table.concat(stem), "a"}
if m_d[word] then m_d[word](stem, data)
else m_d[decl](stem, data) end
if tostring(mw.getCurrentFrame():preprocess('function')):find('<strong class="error"') then --iferror
return "?"
end
return table.concat(data.forms[case], ",")
end
function export.pass_to_module(term, case, gender)
local stem = PAGENAME
local data = {forms = {}, categories = {}}
local decl = gender .. "_" .. detect_decl(stem)
stem = {stem, "a"}
if m_d[word] then m_d[word](stem, data)
else m_d[decl](stem, data) end
return table.concat(data.forms[case], ",")
end
return export