Module:qhv-noun/head: Difference between revisions

From Linguifex
Jump to navigation Jump to search
No edit summary
No edit summary
Line 19: Line 19:
     return "?"
     return "?"
     end
     end
return table.concat(data.forms[case])
end
function export.pass_to_module(case)
local word = PAGENAME
local data = {forms = {}, categories = {}}
local decl, stem = m_p.detect_decl(word)
stem = {table.concat(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])
return table.concat(data.forms[case])

Revision as of 13:03, 15 March 2021



local export = {}

local m_p = require("Module:qhv-noun")
local m_d = require("Module:qhv-noun/data")
local PAGENAME = mw.title.getCurrentTitle().text

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, stem = m_p.detect_decl(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(case)
	local word = PAGENAME
	local data = {forms = {}, categories = {}}
	local decl, stem = m_p.detect_decl(word)
	
	stem = {table.concat(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