Changes

Jump to: navigation, search

Module:Documentation

1,806 bytes added, 09:40, 1 January 2014
i18n for the "editors can experiment" blurb
cfg.startBoxLinkclasses = 'mw-editsection plainlinks' -- The CSS classes used for the [view][edit][history] or [create] links in the start box.
cfg.startBoxLinkId = 'doc_editlinks' -- The HTML "id" attribute for the links in the start box.
cfg.fileDocpagePreload = 'Template:Documentation/preload-filespace' -- A preload Preload file for documentation page in the file namespace.cfg.docpagePreload = 'Template:Documentation/preload-filespace' -- A preload Preload file for template documentation pages in all namespaces.cfg.modulePreload = 'Template:Documentation/preload-module-doc' -- A Preload file for Lua module documentation pages.cfg.templateSandboxPreload = 'Template:Documentation/preload -sandbox' -- Preload file for template sandbox pages.cfg.moduleSandboxPreload = 'Template:Documentation/preload-module-sandbox' -- Preload file for Lua module documentation sandbox pages.cfg.templateTestcasesPreload = 'Template:Documentation/preload-testcases' -- Preload file for template test cases pages.cfg.moduleTestcasesPreload = 'Template:Documentation/preload-module-testcases' -- Preload file for Lua module test cases pages.
-- Settings for the {{fmbox}} template.
cfg.fmboxStyle = 'background-color: #ecfcf4' -- The value sent to the style parameter of {{fmbox}}.
cfg.fmboxTextstyleParam = 'textstyle' -- The name of the "textstyle" parameter of {{fmbox}}.
cfg.fmboxTextstyle = 'font-style: italic;' -- The value send sent to the "textstyle parameter of {{fmbox}}.
-- Display settings
-- Sentences used in the end box.
cfg.transcludedFrom transcludedFromBlurb = 'The above [[Wikipedia:Template documentation|documentation]] is [[Wikipedia:Transclusion|transcluded]] from $1.' -- Notice displayed when the docs are transcluded from another page. $1 is a wikilink to that page.cfg.createModuleDoc createModuleDocBlurb = 'You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].' -- Notice displayed in the module namespace when the documentation subpage does not exist. $1 is a link to create the documentation page with the preload cfg.modulePreload and the display cfg.createLinkDisplay.cfg.templatePossessive = "template's" -- Possessive case for "template".cfg.modulePossessive = "module's" -- Possessive case for "module".cfg.experimentBlurb = 'Editors can experiment in this $1 $2 and $3 pages.' -- Text inviting editors to experiment in sandbox and test cases pages. It is only shown in the template and module namespaces. $1 is cfg.templatePossessive or cfg.modulePossessive depending on what namespace we are in. $2 is a link to the sandbox in the format "cfg.sandboxLinkDisplay (cfg.sandboxEditLinkDisplay | cfg.compareLinkDisplay)" if the sandbox exists, and the format "cfg.sandboxLinkDisplay (cfg.sandboxCreateLinkDisplay | cfg.mirrorLinkDisplay)" if the sandbox doesn't exist. If the sandbox link doesn't exist, the create link preloads the page with cfg.templateSandboxPreload or cfg.moduleSandboxPreload depending on the current namespace. $3 is a link to the test cases page in the format "cfg.testcasesLinkDisplay (cfg.testcasesEditLinkDisplay)" if the test cases page exists, and in the format "cfg.testcasesLinkDisplay (cfg.testcasesCreateLinkDisplay)" if the test cases page doesn't exist. If the test cases page doesn't exist, the create link preloads the page with cfg.templateTestcasesPreload or cfg.moduleTestcasesPreload depending on the current namespace.
-- Other display settings
local editLink = makeUrlLink(docTitle:fullUrl{action = 'edit'}, cfg.editLinkDisplay)
local historyLink = makeUrlLink(docTitle:fullUrl{action = 'history'}, cfg.historyLinkDisplay)
text = text .. formatMessage(cfg.transcludedFromtranscludedFromBlurb, {docLink}) .. ' ' .. makeToolbar(editLink, historyLink) .. '<br />'
elseif subjectSpace == 828 then
-- /doc does not exist; ask to create it.
local createLink = makeUrlLink(docTitle:fullUrl{action = 'edit', preload = cfg.modulePreload}, cfg.createLinkDisplay)
text = text .. formatMessage(cfg.createModuleDoccreateModuleDocBlurb, {createLink}) .. '<br />'
end
-- Add links to /sandbox and /testcases when appropriate.
if subjectSpace == 2 or subjectSpace == 828 or subjectSpace == 10 then
-- We are in the user, module or template namespaces.
local sandboxLinks, testcasesLinks local pagePossessive = subjectSpace == 828 and "module's" cfg.modulePossessive or "template's" text = text .. 'Editors can experiment in this ' .. pagePossessive .cfg. ' 'templatePossessive
local sandboxTitle = mw.title.new(sandbox)
if sandboxTitle.exists then
local sandboxEditLink = makeUrlLink(sandboxTitle:fullUrl{action = 'edit'}, cfg.sandboxEditLinkDisplay)
local compareLink = makeUrlLink(mw.title.new('Special:ComparePages'):fullUrl{page1 = templatePage, page2 = sandbox}, cfg.compareLinkDisplay)
text sandboxLinks = text .. sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink)
else
local sandboxPreload = 'Template:Documentation/preload-' .. (subjectSpace == 828 and 'module-' cfg.moduleSandboxPreload or '') .cfg. 'sandbox'templateSandboxPreload
local sandboxCreateLink = makeUrlLink(sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload}, cfg.sandboxCreateLinkDisplay)
local mirrorSummary = 'Create sandbox version of ' .. makeWikilink(templatePage)
local mirrorLink = makeUrlLink(sandboxTitle:fullUrl{action = 'edit', preload = templatePage, summary = mirrorSummary}, cfg.mirrorLinkDisplay)
text sandboxLinks = text .. cfg.sandboxLinkDisplay .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink)
end
text = text .. ' and '
local testcaseTitle = mw.title.new(testcases)
if testcaseTitle.exists then
local testcasesLink = makeWikilink(testcases, cfg.testcasesLinkDisplay)
local testcasesEditLink = makeUrlLink(testcaseTitle:fullUrl{action = 'edit'}, cfg.testcasesEditLinkDisplay)
text testcasesLinks = text .. testcasesLink .. ' ' .. makeToolbar(testcasesEditLink)
else
local testcasesPreload = 'Template:Documentation/preload-' .. (subjectSpace == 828 and 'module-' cfg.moduleTestcasesPreload or '') .cfg. 'testcases'templateTestcasesPreload
local testcasesCreateLink = makeUrlLink(testcaseTitle:fullUrl{action = 'edit', preload = testcasesPreload}, cfg.testcasesCreateLinkDisplay)
text testcasesLinks = text .. cfg.testcasesLinkDisplay .. ' ' .. makeToolbar(testcasesCreateLink)
end
text = text .. formatMessage(cfg.experimentBlurb, {pagePossessive, sandboxLinks, testcasesLinks}) .. ' pages. <br />'
-- Show the categories text, but not if "content" fed or "docname fed" since then it is unclear where to add the categories.
if not content and not docnameFed then
Anonymous user

Navigation menu