Module:template: Difference between revisions

Jump to navigation Jump to search
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 1: Line 1:
local export = {}
local export = {}


local function make_template(frame, nested)
local function make_template(args, nested)
local args = (frame:getParent() and frame:getParent().args) or frame.args
if not args[i] then error("at least one argument must be given to {{temp}}") end
local out = {(nested and "") or "<code>", "&#123;&#123;[[Template:" .. args[1] .. "|" .. args[1] .. "]]"}
local out = {(nested and "") or "<code>", "&#123;&#123;[[Template:" .. args[1] .. "|" .. args[1] .. "]]"}
local i = 2
local i = 2
Line 19: Line 19:


function export.show(frame)
function export.show(frame)
return make_template(frame, false)
return make_template(frame:getParent().args, false)
end
end


function export.showNested(frame)
function export.showNested(frame)
return make_template(frame, true)
return make_template(frame:getParent().args, true)
end
end


return export
return export

Navigation menu