Module:Wikitable: Difference between revisions

From Vigyanwiki
(Created page with "local p = {}; local getArgs = require('Module:Arguments').getArgs local buffer = require("Module:Buffer")('{|') function p.main(frame) local args = getArgs(frame, {removeBla...")
 
m (1 revision imported from alpha:Module:Wikitable)
 
(No difference)

Latest revision as of 17:10, 20 February 2023

Documentation for this module may be created at Module:Wikitable/doc

local p = {};
local getArgs = require('Module:Arguments').getArgs
local buffer = require("Module:Buffer")('{|')
function p.main(frame)
	local args =  getArgs(frame, {removeBlanks=false, trim=false} )
	for k, v in pairs(args) do
		if type(k) ~= 'number' then buffer:_(string.format(string.match(v, '^["\']') and ' %s=%s' or ' %s="%s"', k, v)) end
	end
	buffer:_'\n'
	for _, v in ipairs(args) do
		if not string.match(v, '^!') then buffer:_'|' end
		buffer:_(v)
	end
	return table.concat(buffer:_'\n|}')
end
return p;