Jump to content

Module:Sandbox/Wqnvlz/Preprocess ISO 3166 data

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by Wqnvlz (talk | contribs) at 06:52, 7 April 2022 (Wqnvlz moved page Module:Sandbox/Wqnvlz to Module:Sandbox/Wqnvlz/Preprocess ISO 3166 data without leaving a redirect). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
local p = {}
local getArgs = require('Module:Arguments').getArgs
local strip = require('Module:ISO 3166/sandbox').strip

function p.run(frame)
	local t = getArgs(frame)[1]
	
	local result = {}
	local inside = false
	local i = 1
	for block in mw.text.gsplit(t, '"', true) do
		result[i] = (inside and strip(block) or block)
		inside = not inside
		i = i + 1
	end
	
	return table.concat(result, '"')
end

return p