Module:Documentation: Difference between revisions

Fix type on doc page
Fixes
Line 19: Line 19:
function p.create( f )
function p.create( f )
local args = require( 'Module:ProcessArgs' ).norm()
local args = require( 'Module:ProcessArgs' ).norm()
page = mw.title.getCurrentTitle()
local page = mw.title.getCurrentTitle()
namespace = args.type or page.nsText
local docPage = args.page or page.nsText .. ':' .. page.baseText .. '/doc'
docPage = args.page or namespace .. ':' .. page.baseText .. '/doc'
local out
local out
Line 35: Line 34:
end
end
out = '{{documentation|' .. table.concat( templateArgs, '|' ) .. '}}' ..
out = '{{documentation|' .. table.concat( templateArgs, '|' ) .. '}}\n' ..
'<!-- Put categories/interwiki on the documentation page -->'
'<!-- Put categories/interwiki on the documentation page -->'
out = out:gsub( '|}}', '}}' )
out = out:gsub( '|}}', '}}' )
Line 62: Line 61:
local page = mw.title.getCurrentTitle()
local page = mw.title.getCurrentTitle()
local namespace = args.type or page.nsText
local namespace = page.nsText
local pageType = getType( namespace, page )
local pageType = mw.ustring.lower( args.type or getType( namespace, page ) )
local body = mw.html.create( 'div' )
local body = mw.html.create( 'div' )
Line 84: Line 83:
)
)
if badDoc then
if badDoc then
body:wikitext( "'''This ", pageType, "'s documentation needs improving or additional information.'''" )
body:wikitext( "<br>'''This ", pageType, "'s documentation needs improving or additional information.'''" )
end
end
if not args.nocat then
if not args.nocat then
Line 97: Line 96:
local args = require( 'Module:ProcessArgs' ).merge( true )
local args = require( 'Module:ProcessArgs' ).merge( true )
local page = mw.title.getCurrentTitle()
local page = mw.title.getCurrentTitle()
local namespace = args.type or page.nsText
local namespace = page.nsText
local docPage = mw.title.new( args.page or namespace .. ':' .. page.text .. '/doc' )
local docPage = mw.title.new( args.page or namespace .. ':' .. page.text .. '/doc' )
local noDoc = args.nodoc or not docPage.exists
local noDoc = args.nodoc or not docPage.exists
local badDoc = args.baddoc
local badDoc = args.baddoc
local pageType = getType( namespace, page )
local pageType = mw.ustring.lower( args.type or getType( namespace, page ) )
local docText
local docText