Jump to content

Module:Documentation: Difference between revisions

internationalise the sandbox template notice call
m>Mr. Stradivarius
(more il8n work)
m>Mr. Stradivarius
(internationalise the sandbox template notice call)
Line 29: Line 29:
cfg.mainDivClasses = 'template-documentation iezoomfix' -- The CSS classes added to the main HTML "div" tag.
cfg.mainDivClasses = 'template-documentation iezoomfix' -- The CSS classes added to the main HTML "div" tag.
cfg.sandboxSubpage = 'sandbox' -- The name of the template subpage typically used for sandboxes.
cfg.sandboxSubpage = 'sandbox' -- The name of the template subpage typically used for sandboxes.
cfg.sandboxNoticeTemplate = 'template sandbox notice' -- The name of the template to display at the top of sandbox pages.
cfg.sandboxNoticeLivepageParam = 1 -- The parameter of the sandbox notice template to send the cfg.livepageArg to.


-- Display settings
-- Display settings
Line 131: Line 133:


function p.sandboxNotice(args)
function p.sandboxNotice(args)
if currentTitle.subpageText == cfg.sandboxSubpage then
local sandboxNoticeTemplate = cfg.sandboxNoticeTemplate
local frame = mw.getCurrentFrame()
if not (sandboxNoticeTemplate and currentTitle.subpageText == cfg.sandboxSubpage) then
local root = htmlBuilder.create()
root
.tag('div')
.css('clear', 'both')
.done()
.wikitext(frame:expandTemplate{title = 'template sandbox notice', args = {args[cfg.livepageArg]}})
return tostring(root)
else
return nil
return nil
end
end
local frame = mw.getCurrentFrame()
local notice = htmlBuilder.create()
notice
.tag('div')
.css('clear', 'both')
.done()
.wikitext(frame:expandTemplate{title = sandboxNoticeTemplate, args = {[cfg.sandboxNoticeLivepageParam] = args[cfg.livepageArg]}})
return tostring(notice)
end
end


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