Difference between revisions of "Module:Expand wikitext"

From blackwiki
Jump to navigation Jump to search
blackwiki>Pppery
(Allow entire code to be wrapper in a nowiki tag, for case when constructing the desired code requires too much escaping)
blackwiki>Pppery
(Add support for unstrip parameter)
Line 3: Line 3:
 
function p.main(frame)
 
function p.main(frame)
 
local code = frame.args[1]
 
local code = frame.args[1]
if mw.text.trim(mw.text.killMarkers(code)) == "" then
+
if mw.text.trim(mw.text.killMarkers(code)) == "" or frame.args.unstrip then
 
code = mw.text.unstripNowiki(code);
 
code = mw.text.unstripNowiki(code);
 
end
 
end

Revision as of 22:06, 21 June 2017

Implements {{Expand wikitext}}.


local p = {}

function p.main(frame)
	local code = frame.args[1]
	if mw.text.trim(mw.text.killMarkers(code)) == "" or frame.args.unstrip then
		code = mw.text.unstripNowiki(code);
	end
	return frame:preprocess(code)
end

return p