Module:Documentation: Difference between revisions

more il8n work
(put argument names into a config file for easy porting to other wikis)
(more il8n work)
Line 21:
cfg.contentArg = 'content' -- Passes documentation content directly from the {{documentation}} invocation.
cfg.linkBoxArg = 'link box' -- Specifies a custom link box (end box) or prevents it from being generated.
 
-- Software settings
-- The following are software settings that may change from wiki to wiki. For example, the classes
-- defined in commons.css or the names of templates.
 
cfg.mainDivId = 'template-documentation' -- The "id" attribute of 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.
 
-- Display settings
-- The following settings configure the values displayed by the module.
 
cfg.sandboxLinkDisplay = 'sandbox'
 
----------------------------------------------------------------------------
Line 104 ⟶ 117:
-- so that we don't have to worry about unclosed tags.
.tag('div')
.attr('id', 'template-documentation'cfg.mainDivId)
.addClass('template-documentation iezoomfix'cfg.mainDivClasses)
.wikitext(p._startBox(args))
.wikitext(p._content(args))
Line 118 ⟶ 131:
 
function p.sandboxNotice(args)
if currentTitle.subpageText == 'sandbox'cfg.sandboxSubpage then
local frame = mw.getCurrentFrame()
local root = htmlBuilder.create()
Line 293 ⟶ 306:
local docExist = docTitle.exists
local docnameFed = args[1] and true
local sandbox = docpageRoot .. '/sandbox' .. cfg.sandboxSubpage
local testcases = docpageRoot .. '/testcases'
templatePage = currentTitle.nsText .. ':' .. templatePage
Line 337 ⟶ 350:
local sandboxTitle = mw.title.new(sandbox)
if sandboxTitle.exists then
local sandboxLink = makeWikilink(sandbox, 'sandbox'cfg.sandboxLinkDisplay)
local sandboxEditLink = makeUrlLink(sandboxTitle:fullUrl{action = 'edit'}, 'edit')
local compareLink = makeUrlLink(mw.title.new('Special:ComparePages'):fullUrl{page1 = templatePage, page2 = sandbox}, 'diff')
Line 346 ⟶ 359:
local mirrorSummary = 'Create sandbox version of ' .. makeWikilink(templatePage)
local mirrorLink = makeUrlLink(sandboxTitle:fullUrl{action = 'edit', preload = templatePage, summary = mirrorSummary}, 'mirror')
text = text .. cfg.sandboxLinkDisplay .. 'sandbox ' .. makeToolbar(sandboxCreateLink, mirrorLink)
end
text = text .. ' and '
Line 417 ⟶ 430:
-- Determines the template page. No namespace or interwiki prefixes are included.
local subpage = currentTitle.subpageText
if subpage == 'sandbox'cfg.sandboxSubpage or subpage == 'testcases' then
return currentTitle.baseText
else