Module:Sandbox/Ahecht/navboxtolua

This is an old revision of this page, as edited by Ahecht (talk | contribs) at 03:36, 25 December 2023 (process list). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

return {[''] = function(frame)
	local lists = {}
	local args = require('Module:Arguments').getArgs(frame)
	local output = "{\n"
	for k,v in pairs(args) do
		if mw.ustring.find(v,'\n',1,true) then
			table.insert(lists, "===" .. mw.ustring.upper(k) .. "===\n" .. mw.ustring.gsub(mw.ustring.gsub(v,"%[","【"),"%]","】") .. "\n")
			output = output .. k .. ' = [=[<ul>\n<!--' .. mw.ustring.upper(k) .. '-->\n</ul>]=],\n'
		else
			output = output .. k .. ' = "'  .. v .. '",\n'
		end
	end
	return "==Params==\n" .. frame:callParserFunction( '#tag', 'pre', output .. "}" ) .. '\n==Lists==\n' .. table.concat(lists)
	end
}