Module:qhv-noun: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 27: Line 27:
end
end


function export.detect_decl(word, number, class)
function detect_decl(word, number, class)
local word = mw.title.getCurrentTitle().text
if number and class then
if number and class then
local decl = number .. "-" .. class
local decl = number .. "-" .. class
Line 35: Line 34:
for ending, decl in pairs(endings) do
for ending, decl in pairs(endings) do
if find(word, ending .. "$") then
if find(word, ending .. "$") then
return decl, table.concat({sub(word, 1, -(#ending + 1))})
return decl, {sub(word, 1, -(#ending + 1))}
end
end
end
end
Line 62: Line 61:
numbers = {parent_args[1]}
numbers = {parent_args[1]}
else
else
decl_type, numbers = export.detect_decl(word, parent_args.n, parent_args.c)
decl_type, numbers = detect_decl(word, parent_args.n, parent_args.c)
end
end
end
end
Line 72: Line 71:
args = require("Module:parameters").process(parent_args, alldata[decl_type].params, true)
args = require("Module:parameters").process(parent_args, alldata[decl_type].params, true)
if stems then
if numbers then
for i, stem in ipairs(stems) do
for i, number in ipairs(numbers) do
args[i] = stem
args[i] = number
end
end
end
end