Module:Sandbox/Erutuon/HTML

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by imported>Erutuon at 00:02, 27 September 2016 (use addClass). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

f = {}

function f.HTML_table(frame)
	local cell_content = mw.text.split ( frame.args[1], '%s' )
	local cell_colors = mw.text.split ( frame.args[2], '%s' )
	local t = mw.html.create("table")
		t:addClass("wikitable")
	local tr = t:tag("tr")
	for i in pairs(cell_content) do
		td = tr:tag("td")
		td
			:wikitext(cell_content[i])
			:cssText("color: " .. cell_colors[i] .. ";")
	end
	return tostring(td:allDone())
end

return f