Module:$var
Appearance
From mediawiki.org
This module is rated as alpha. It is ready for third party input, and may be used on a few pages to see if problems arise, but should be watched. Suggestions for new features or changes in their input and output mechanisms are welcome.
Lua module for rendering the source of template transclusions using $var .
Usage
{{#invoke:$var|$var_name}}
The above documentation is transcluded from Module:$var/doc. (edit | history)
Editors can experiment in this module’s sandbox (create | mirror) and testcases (create) pages.
Subpages of this module.
Editors can experiment in this module’s sandbox (create | mirror) and testcases (create) pages.
Subpages of this module.
-- <nowiki> -------------------------------------------------------------------------------- -- Lua module for rendering the source of template transclusions using -- [[mw:Special:MyLanguage/Help:Extension:Translate/Page translation administration#Variables|$<var>var</var>]]. -- -- @module $var -- @alias p -- @author [[User:ExE Boss]] -- @require [[Module:Arguments]] -------------------------------------------------------------------------------- require("strict") localgetArgs=require("Module:Arguments").getArgs localfunctionechoSource(name,args) localcontent=mw.html.create() localunnamed={} content:wikitext("{{",name) fori,vinipairs(args)do unnamed[i]=true-- unnamed arguments can have leading and trailing whitespace content:wikitext("|",v)-- XXX: escape "|" as "{{!}}"? end fork,vinpairs(args)do ifnotunnamed[k]then content:wikitext("|",k,"=",v)-- XXX: escape "|" and "=" as "{{!}}" and "{{=}}"? end end content:wikitext("}}") returntostring(mw.html.create("code"):wikitext(mw.text.nowiki(tostring(content:allDone()))):allDone()) end localmt={} functionmt:__index(name) iftype(name)=="string"andmw.ustring.find(name,"^%$.")then returnfunction(frame) localargs=getArgs(frame,{ trim=false, removeBlanks=false, wrappers={ "Template:1ドル", "Template:2ドル", "Template:3ドル", "Template:4ドル", "Template:5ドル", "Template:6ドル", "Template:7ドル", "Template:8ドル", "Template:9ドル", }, }) returnechoSource(name,args) end end end returnsetmetatable({},mt)