Jump to content

Module:Documentation: Difference between revisions

Only load Module:Module wikitext if it's actually needed
m (1 revision imported)
(Only load Module:Module wikitext if it's actually needed)
Line 129: Line 129:
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 323: Line 324:
-- 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)
Anonymous user