Module:Sandbox
Appearance
File:Edit In Sandbox Icon - Color.svg | Welcome to Module:Sandbox, a Wikipedia module sandbox. This page is itself a module, and it allows you to carry out experiments related to module editing. If you wish to experiment with article editing, use the Wikipedia Sandbox or your own user sandbox.
To edit, click the edit tab above, make your changes and click the Publish changes button when finished. Please do not place malicious Lua code here, or copyrighted, offensive, illegal or libelous content in the sandboxes. For assistance with Lua coding, try the technical forum at the Village Pump. There are also several template sandboxes you can use to carry out experiments: Template:Hlist You can also conduct tests using the Wikipedia Sandbox. For instance, to invoke this module there, [{{fullurl:Template:Transclude|action=edit}} edit it] so that it includes:{{#invoke:Sandbox}} | More info Template:Hlist Sandbox games |
Usage[edit source]
{{#invoke:Sandbox|function_name}}
local p = {}
function p._main(args, frame, title)
args = args or {}
frame = frame or mw.getCurrentFrame()
title = title or mw.title.getCurrentTitle()
local italics, italicsAll, lowerCase = false, false, false
for k, v in pairs(args) do
if type(k) == 'number' then
if v == 'kiçik hərf' or v == 'kiçik' then
lowerCase = true
end
if v == 'kursiv' then
italics = true
italicsAll = false
end
if v == 'hamısı kursiv' then
italicsAll = true
italics = false
end
end
end
local result = title.text
if lowerCase then
result = mw.language.getContentLanguage():lcfirst(result)
end
if italics or italicsAll then
local prefix, parentheses = mw.ustring.match(result, '^(.+) (%([^%(%)]+%))$')
if prefix and parentheses and italicsAll == false then
result = string.format("<i>%s</i> %s", prefix, parentheses)
else
result = string.format("<i>%s</i>", result)
end
end
if title.namespace ~= 0 then
result = title.nsText:gsub('_', ' ') .. ':' .. result
end
if args['başlıq'] then
return result
else
return frame:callParserFunction('DISPLAYTITLE', result, 'noerror')
end
end
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {
wrappers = 'Şablon:Başlıq'
})
local title
if args['başlıq'] then
title = mw.title.new(args['başlıq'])
end
return p._main(args, frame, title)
end
return p