Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Documentation: Difference between revisions

From WikiOasis Meta
m 1 revision imported from wikipedia:Module:Documentation: Importing from English Wikipedia to sync templates
mediawiki>Uzume
cherry pick Module wikitext support from w:en:Module:Documentation
Line 82: Line 82:
ret[#ret + 1] = select(i, ...)
ret[#ret + 1] = select(i, ...)
end
end
return '<small>(' .. table.concat(ret, ' &#124; ') .. ')</small>'
return '<small style="font-style: normal;">(' .. table.concat(ret, ' &#124; ') .. ')</small>'
end
end


Line 137: Line 137:
local root = mw.html.create()
local root = mw.html.create()
root
root
:wikitext(p._getModuleWikitext(args, env))
:wikitext(p.protectionTemplate(env))
:wikitext(p.protectionTemplate(env))
:wikitext(p.sandboxNotice(args, env))
:wikitext(p.sandboxNotice(args, env))
Line 326: Line 327:
-- Auxiliary templates
-- Auxiliary templates
----------------------------------------------------------------------------
----------------------------------------------------------------------------
p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')
function p._getModuleWikitext(args, env)
local currentTitle = mw.title.getCurrentTitle()
if currentTitle.contentModel ~= 'Scribunto' then return end
pcall(require, currentTitle.prefixedText) -- if it fails, we don't care
local moduleWikitext =  package.loaded["Module:Module wikitext"]
if moduleWikitext then
return moduleWikitext.main()
end
end


function p.sandboxNotice(args, env)
function p.sandboxNotice(args, env)
Line 397: Line 410:
omargs.text = text
omargs.text = text
omargs.class = message('sandbox-class')
omargs.class = message('sandbox-class')
return messageBox.main('ombox', omargs)
local ret = '<div style="clear: both;"></div>'
ret = ret .. messageBox.main('ombox', omargs)
return ret
end
end


Line 523: Line 538:
local function escapeBrackets(s)
local function escapeBrackets(s)
-- Escapes square brackets with HTML entities.
-- Escapes square brackets with HTML entities.
s = s:gsub('%[', '&#91;') -- Replace square brackets with HTML entities.
s = s:gsub('%]', '&#93;')
return s
return s
    :gsub('%[', '&#91;') -- Replace square brackets with HTML entities.
    :gsub('%]', '&#93;')
end
end


Cookies help us deliver our services. By using our services, you agree to our use of cookies.