Module:Sandbox/KEmel49
Appearance
- Step 1:
This will go in module
function p.hello(frame)
if frame.args[1] == nil then
return "[[Module:Sandbox/KEmel49]]"
elseif frame.args[1] then
return '[[Module:'..frame.args[1]..'|'..frame.args[1]..']]'
end
end
return p
- Step 2:
This will go in template page
{{#invoke:Sandbox/KEmel49|hello}}
- Step 3:
Final output
{{Templatepage}}
output:
Module:Sandbox/KEmel49
{{Templatepage |Math}}
output:
Math
Navigate to
local p = {}
function p.greet(frame)
local name = frame.args.name or frame.args[1] or ""
if name == "" then
return '<strong class="error">Unable to fetch any username</strong>'
end
local title = mw.title.new('User:'.. name)
if title and title.exists then
return 'Hello [[User:'..name..'|'..name..']]'
else
return '<strong class="error">Userpage does not exist or user is not registered</strong>'
end
end
function p.hello(frame)
if frame.args[1] == nil then
return "[[Module:Sandbox/KEmel49]]"
elseif frame.args[1] then
return '[[Module:'..frame.args[1]..'|'..frame.args[1]..']]'
end
end
function p.sign()
return '[[User:KEmel49|KEmel49]]•<sup>([[User talk:KEmel49|talk]]•[[Special:Contributions/KEmel49|contributions]])</sup>'
end
function p.notify(frame)
local args = frame.args
local article = args.article or ""
local diff = args.diff or ""
local cite_format = args["cite_format"] or ""
local ogurl = args.ogurl or ""
local username = mw.title.getCurrentTitle().text
local out = {}
table.insert(out, "== Re: " .. article .. " ==\n\n")
table.insert(out, '[[File:Information.svg|20px]] Hello ' .. username .. ', This is to let you know that ')
if diff ~= "" then
table.insert(out, '[[Special:Diff/' .. diff .. '|one of your recent edits]]')
else
table.insert(out, 'one of your recent edits')
end
table.insert(out, ' at \'\'[[' .. article .. ']]\'\' caused a citation error. ')
if cite_format ~= "" then
table.insert(out, 'you have added invalid url at {{Tl|' .. cite_format .. '}} template. ')
end
if ogurl ~= "" then
table.insert(out, 'Your url input was <code>' .. mw.text.nowiki(ogurl) .. '</code>. ')
end
table.insert(out, 'Do not add invalid URLs and use preview before saving your edit. Happy editing.')
table.insert(out, ' <!-- User:KEmel49/sandbox 5 -->')
return table.concat(out)
end
return p