Documentația acestui modul poate fi creată la Modul:Postnominals/doc

local p = {}
local getArgs = require('Modul:Arguments').getArgs
local TableTools = require('Modul:TableTools')
local data = mw.loadData('Modul:Postnominals/data')

local function fromArgs(country, titles, postnoms, size)
	local htmlContainer = mw.html.create('span'):css('font-size', size or '85%')
	if postnoms then return tostring(htmlContainer:wikitext(postnoms)) end
	local listToPrint = {}
	for _,eachTitle in ipairs(titles) do
		if data[country][eachTitle] then
			table.insert(listToPrint, data[country][eachTitle])
		end
	end
	return tostring(htmlContainer:wikitext(table.concat(listToPrint, ' ')))
end

local function fromFrame(frame)
	local args = getArgs(frame)
	local country = args['country'] or 'CAN'
	
	local numKeys = TableTools.numKeys(args)
	local titles = {}
	for _,eachKey in ipairs(numKeys) do
		table.insert(titles, args[eachKey])
	end
	
	return fromArgs(country, titles, args['post-noms'])
end

p.fromArgs = fromArgs
p.fromFrame = fromFrame
return p