Module:Sandbox/User:Simanelix/One line

Jump to navigation Jump to search

Usage[edit source]

This module makes code single line. It is useful for including some templates in things like wiki tables and lists without having to complicate everything with HTML.

[view] [edit] [history] [refresh]The above documentation is transcluded from Module:Sandbox/User:Simanelix/One line/doc.
local p = {}

function p.output(f)

	local args = f
	if f == mw.getCurrentFrame() then 
		args = require('Module:ProcessArgs').merge(true)
	end
	
	local output = assert(args[1], 'No tag text provided.?')
	
	-- replace all newlines with <br>
	replacement = args["repl"] or "<br>"
	output = string.gsub(output, "\n", replacement)
	
	return output
	
end

return p