Module:qhv-noun/head: Difference between revisions

From Linguifex
Jump to navigation Jump to search
No edit summary
No edit summary
Line 23: Line 23:
end
end


function export.pass_to_module(case)
function export.pass_to_module(case, term)
local word = PAGENAME
local word = term or PAGENAME
local data = {forms = {}, categories = {}}
local data = {forms = {}, categories = {}}
local decl, stem = m_p.detect_decl(word)
local decl, stem = m_p.detect_decl(word)

Revision as of 15:44, 18 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, term)
	local word = term 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
	
	return table.concat(data.forms[case], ",")
end

return export