Module:Documentation: Difference between revisions
From Video Credit Archive
Content deleted Content added
wikpedia>Mr. Stradivarius create a formatMessage function for formatting cfg messages in an arbitrary order |
wikpedia>Mr. Stradivarius i18n for the "editors can experiment" blurb |
||
Line 42:
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' --
cfg.docpagePreload = 'Template:Documentation/preload-filespace' --
cfg.modulePreload = 'Template:Documentation/preload-module-doc' --
cfg.templateSandboxPreload = 'Template:Documentation/preload-sandbox' -- Preload file for template sandbox pages.
cfg.moduleSandboxPreload = 'Template:Documentation/preload-module-sandbox' -- Preload file for Lua module 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.
Line 55 ⟶ 59:
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
-- Display settings
Line 76 ⟶ 80:
-- Sentences used in the end box.
cfg.
cfg.
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
Line 411 ⟶ 418:
local editLink = makeUrlLink(docTitle:fullUrl{action = 'edit'}, cfg.editLinkDisplay)
local historyLink = makeUrlLink(docTitle:fullUrl{action = 'history'}, cfg.historyLinkDisplay)
text = text .. formatMessage(cfg.
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.
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
local sandboxTitle = mw.title.new(sandbox)
if sandboxTitle.exists then
Line 427 ⟶ 434:
local sandboxEditLink = makeUrlLink(sandboxTitle:fullUrl{action = 'edit'}, cfg.sandboxEditLinkDisplay)
local compareLink = makeUrlLink(mw.title.new('Special:ComparePages'):fullUrl{page1 = templatePage, page2 = sandbox}, cfg.compareLinkDisplay)
else
local sandboxPreload =
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)
end
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)
else
local testcasesPreload =
local testcasesCreateLink = makeUrlLink(testcaseTitle:fullUrl{action = 'edit', preload = testcasesPreload}, cfg.testcasesCreateLinkDisplay)
end
text = text ..
-- 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
|