Module:Road data/countrymask/parser

MyWikiBiz, Author Your Legacy — Monday December 02, 2024
< Module:Road data‎ | countrymask
Revision as of 05:40, 16 July 2021 by Zoran (talk | contribs) (Pywikibot 6.4.0)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Documentation for this module may be created at Module:Road data/countrymask/parser/doc

local p = { }

function p.mask(frame)
	local pframe = frame:getParent()
	local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
	local args = pframe.args -- the arguments passed TO the template, in the wikitext that transcludes the template
	
	local data = mw.loadData("Module:Road data/countrymask")
	local country = args[2] or ''
	if country ~= '' then return string.upper(country) end
	local state = args[1] or ''
	return data[state] or 'UNK'
end

return p