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) | ||
local sandboxNoticeTemplate = cfg.sandboxNoticeTemplate | |||
if not (sandboxNoticeTemplate and currentTitle.subpageText == cfg.sandboxSubpage) then | |||
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 | ||