This Lua module is used on approximately 102,000 pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
Interprets the input as wikitext using the frame:preprocess
function. Any arguments passed to {{Expand wikitext}} are available in the preprocessed code, letting this be used as a rudimentary way of using variables.
If the entire input is in a nowiki tag, or if the optional parameter |unstrip=yes
is specified, first extracts the contents of nowiki tags before preprocessing.
Example
{{#invoke:expand wikitext|main|{{Make code|<<As of!2015!02>>}}}}
→ As of February 2015[update]<table>{{#invoke:expand wikitext|main|<nowiki>{{Episode list/sublist | 1 = One Piece (season 15) | EpisodeNumber = {{{ep}}} | Title = An Explosive Situation! Luffy vs. Fake Luffy! | OriginalAirDate = {{Date|2011-10-02 +{{#expr:({{{ep}}})-517}} weeks }} }} </nowiki>|ep=518}}</table>
→
{{#invoke:expand wikitext|main|<nowiki>{{2x|x}}-</nowiki>}}
→ {{2x|x}}-{{#invoke:expand wikitext|main|<nowiki>{{2x|x}} -</nowiki>}}
→ xx -{{#invoke:expand wikitext|main|<nowiki><u>u</u><ref>text</ref></nowiki>}}
→ <u>u</u><ref>text</ref>
local p = {}
local yesno = require("Module:Yesno")
function p.main(frame)
local pframe = frame:getParent()
local code = frame.args[1]
if mw.text.trim(mw.text.killMarkers(code)) == "" or yesno(frame.args.unstrip) then
code = mw.text.unstripNoWiki(code);
end
return pframe:preprocess(code)
end
return p