45,660
edits
No edit summary |
No edit summary |
||
Line 50: | Line 50: | ||
function export.head(frame) | function export.head(frame) | ||
local arguments = frame.args | local arguments = frame.args | ||
local numbers = nil | |||
local decl = {} | |||
local word = arguments.word or PAGENAME | |||
local args = {} | |||
if not alldata[word] then | |||
if arguments.n and arguments.c and arguments[1] then | |||
decl_type = arguments.n .. "-" .. arguments.c | |||
numbers = {arguments[1]} | |||
else | |||
decl_type, numbers = export.detect_decl(word, arguments.n, arguments.c) | |||
end | |||
if not decl_type then | |||
error("Unknown declension '" .. decl_type .. "'") | |||
end | |||
args = require("Module:parameters").process(arguments, alldata[decl_type].params, true) | |||
if numbers then | |||
for i, number in ipairs(numbers) do | |||
args[i] = number | |||
end | |||
end | |||
end | |||
-- Generate the forms | |||
if alldata[word] then | |||
return alldata[word](arguments).forms[arguments[2] .. "-" .. arguments[3]] | |||
else | |||
return alldata[decl_type](args).forms[arguments[2] .. "-" .. arguments[3]] | |||
end | |||
end | end | ||