Module:Documentation: Difference between revisions

don't use messages for args either - would be a pain for other modules that have to use this module
m>Mr. Stradivarius
(don't use messages for fmbox parameter names)
m>Mr. Stradivarius
(don't use messages for args either - would be a pain for other modules that have to use this module)
Line 188: Line 188:
-- The title object for the current page, or a test page passed with args.page.
-- The title object for the current page, or a test page passed with args.page.
local title
local title
local titleArg = args[message('titleArg', 'string')]
local titleArg = args.page
if titleArg then
if titleArg then
title = mw.title.new(titleArg)
title = mw.title.new(titleArg)
Line 317: Line 317:
.css('clear', 'both')
.css('clear', 'both')
.done()
.done()
.wikitext(frame:expandTemplate{title = sandboxNoticeTemplate, args = {[message('sandboxNoticeLivepageParam')] = args[message('livepageArg', 'string')]}})
.wikitext(frame:expandTemplate{title = sandboxNoticeTemplate, args = {[message('sandboxNoticeLivepageParam')] = args.livepage}})
return tostring(notice)
return tostring(notice)
end
end
Line 355: Line 355:
-- Generate [view][edit][history][purge] or [create] links.
-- Generate [view][edit][history][purge] or [create] links.
local links
local links
local content = args[message('contentArg', 'string')]
local content = args.content
if not content then
if not content then
-- No need to include the links if the documentation is on the template page itself.
-- No need to include the links if the documentation is on the template page itself.
Line 395: Line 395:
data.purgeLinkDisplay = message('purgeLinkDisplay', 'string')
data.purgeLinkDisplay = message('purgeLinkDisplay', 'string')
-- Create link if /doc doesn't exist.
-- Create link if /doc doesn't exist.
local preload = args[message('preloadArg', 'string')]
local preload = args.preload
if not preload then
if not preload then
if env.subjectSpace == 6 then -- File namespace
if env.subjectSpace == 6 then -- File namespace
Line 432: Line 432:
-- Heading
-- Heading
local heading = args[message('headingArg', 'string')] -- Blank values are not removed.
local heading = args.heading -- Blank values are not removed.
if heading == '' then
if heading == '' then
-- Don't display the start box if the heading arg is defined but blank.
-- Don't display the start box if the heading arg is defined but blank.
Line 450: Line 450:
-- Heading CSS
-- Heading CSS
local headingStyle = args[message('headingStyleArg', 'string')]
local headingStyle = args['heading-style']
if headingStyle then
if headingStyle then
data.headingStyleText = headingStyle
data.headingStyleText = headingStyle
Line 501: Line 501:


function p._content(args, env)
function p._content(args, env)
local content = args[message('contentArg', 'string')]
local content = args.content
if not content then
if not content then
local docpage = args[1]
local docpage = args[1]
Line 531: Line 531:


-- Argument processing in {{documentation}}.
-- Argument processing in {{documentation}}.
local content = args[message('contentArg', 'string')]
local content = args.content
local linkBox = args[message('linkBoxArg', 'string')] -- So "link box=off" works.
local linkBox = args['link box'] -- So "link box=off" works.
local docspace = env.docspace
local docspace = env.docspace
local docname = args[1] -- Other docname, if fed.
local docname = args[1] -- Other docname, if fed.
Anonymous user