Changes

Jump to: navigation, search

Module:Documentation

1,199 bytes added, 23:20, 15 January 2014
convert the sandbox notice code to Lua
function p.sandboxNotice(args, env)
local sandboxNoticeTemplate title = env.title local sandboxTitle = env.sandboxTitle local templateTitle = message('sandboxNoticeTemplate', 'string')env.templateTitle if not (sandboxNoticeTemplate title and envsandboxTitle and templateTitle and mw.title.subpageText == messageequals('sandboxSubpage'title, 'string'sandboxTitle)) then
return nil
end
local omargs = {} -- Args for {{ombox}}.
-- Get the image wikitext.
omargs.image = message('sandboxNoticeImage', 'string')
-- Get the text. We start with the opening blurb, which is something like
-- "This is the template sandbox for [[Template:Foo]] (diff)."
local text = ''
local frame = mw.getCurrentFrame()
local notice isPreviewing = htmlBuilderframe:callParserFunction('REVISIONID') == '' -- True if the page is being previewed.create local templateLink = makeWikilink(templateTitle.prefixedText) noticeif isPreviewing then -- 'This is the [[Wikipedia:Template test cases|template sandbox]] page for $1.' text = text ..tagmessage('divsandboxNoticeBlurb', 'string', {templateLink}) else -- 'This is the [[Wikipedia:Template test cases|template sandbox]] page for $1 ($2).' text = text ..cssmessage('clearsandboxNoticeDiffBlurb', 'bothstring', {templateLink, env.compareLink}) end -- Get the test cases page blurb if the page exists. local testcasesTitle = env.testcasesTitle if testcasesTitle and testcasesTitle.doneexists then local testcasesLinkDisplay = message('sandboxNoticeTestcasesLinkDisplay', 'string') local testcasesLink = makeWikilink(testcasesTitle.wikitext(frame:expandTemplate{title = sandboxNoticeTemplateprefixedText, args testcasesLinkDisplay) text = {[text .. ' ' .. message('sandboxNoticeLivepageParamsandboxNoticeTestcasesBlurb', 'string', {testcasesLink}) end -- Add the page to [[Category:Template sandboxes]] . text = argstext ..livepage}}makeCategoryLink(message('sandboxCategory', 'string')) omargs.text = text return tostringmessageBox.main(notice'ombox', omargs)
end
Anonymous user

Navigation menu