Anonymous user
Module:Documentation: Difference between revisions
m
Topic:V24p1ieaeai6tho8
m (Lua error) |
|||
Line 7:
-- Get the config table.
local cfg = mw.loadData('Module:Documentation/config')
local i18n = mw.loadData('Module:Documentation/i18n')
local p = {}
Line 33:
expectType = expectType or 'string'
if type(msg) ~= expectType then
error(require('
end
if not valArray then
Line 41:
local function getMessageVal(match)
match = tonumber(match)
return valArray[match] or error(require('
end
Line 112:
----------------------------------------------------------------------------
-- Load TemplateStyles
-- Main function▼
----------------------------------------------------------------------------
p.main =
local parent = frame.getParent(frame)
local output = p._main(parent.args)
return frame:extensionTag{ name='templatestyles', args = { src= message('templatestyles-scr') } } .. frame:preprocess(output)
----------------------------------------------------------------------------
▲-- Main function
----------------------------------------------------------------------------
function p._main(args)
Line 135 ⟶ 143:
:tag('div')
:attr('id', message('main-div-id'))
:addClass(message('main-div-
:wikitext(p._startBox(args, env))
:wikitext(p._content(args, env))
:tag('div')▼
:done()
:wikitext(p._endBox(args, env))
Line 379 ⟶ 381:
local testcasesTitle = env.testcasesTitle
if testcasesTitle and testcasesTitle.exists then
if testcasesTitle.
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display')
Line 394 ⟶ 396:
text = text .. makeCategoryLink(message('sandbox-category'))
omargs.text = text
omargs.class = message('sandbox-class')
local ret = '<div style="clear: both;"></div>'
ret = ret .. messageBox.main('ombox', omargs)
Line 485 ⟶ 488:
if not title or not docTitle then
return nil
end
if docTitle.isRedirect then
docTitle = docTitle.redirectTarget
end
Line 491 ⟶ 497:
data.docTitle = docTitle
-- View, display, edit, and purge links if /doc exists.
data.viewLinkDisplay =
data.editLinkDisplay =
data.historyLinkDisplay =
data.purgeLinkDisplay =
-- Create link if /doc doesn't exist.
local preload = args.preload
Line 507 ⟶ 513:
end
data.preload = preload
data.createLinkDisplay =
return data
end
Line 578 ⟶ 584:
data.heading = heading
elseif subjectSpace == 10 then -- Template namespace
data.heading =
elseif subjectSpace == 828 then -- Module namespace
data.heading =
elseif subjectSpace == 6 then -- File namespace
data.heading =
else
data.heading =
▲ end
end
Line 614 ⟶ 608:
local sbox = mw.html.create('div')
sbox
:addClass(message('header-div-class'))
:wikitext(data.heading)▼
local links = data.links
if links then
sbox
:
:
:attr('id', data.linksId)
:wikitext(links)
end
sbox
:addClass(message('heading-div-class'))
▲ :wikitext(data.heading)
return tostring(sbox)
end
Line 651 ⟶ 642:
-- The line breaks below are necessary so that "=== Headings ===" at the start and end
-- of docs are interpreted correctly.
local cbox = mw.html.create('div')
return '\n' .. (content or '') .. '\n' ▼
cbox
:addClass(message('content-div-class'))
return tostring(cbox)
end
Line 677 ⟶ 672:
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--]=]
Line 709 ⟶ 697:
end
-- Assemble the
local text = ''
if linkBox then
Line 741 ⟶ 722:
end
end
local ebox = mw.html.create('div')
ebox
:addClass(message('footer-div-class'))
:wikitext(text)
return tostring(ebox)
end
Line 772 ⟶ 756:
local docLink = makeWikilink(docTitle.prefixedText)
local editUrl = docTitle:fullUrl{action = 'edit'}
local editDisplay =
local editLink = makeUrlLink(editUrl, editDisplay)
local historyUrl = docTitle:fullUrl{action = 'history'}
local historyDisplay =
local historyLink = makeUrlLink(historyUrl, historyDisplay)
ret = message('transcluded-from-blurb', {docLink})
Line 784 ⟶ 768:
-- /doc does not exist; ask to create it.
local createUrl = docTitle:fullUrl{action = 'edit', preload = message('module-preload')}
local createDisplay =
local createLink = makeUrlLink(createUrl, createDisplay)
ret = message('create-module-doc-blurb', {createLink})
|