Module:Documentation: Difference between revisions

m Add debug logs
Replace faulty dplvars
Line 16: Line 16:
end
end
mw.logObject(pageType, "Module:Documentation: pageType")
return pageType
return pageType
end
end
Line 62: Line 61:
local badDoc = args.baddoc
local badDoc = args.baddoc
mw.logObject(badDoc, "Module:Documentation: badDoc")
mw.logObject(badDoc, "Module:Documentation: badDoc")
local dplvar = f:callParserFunction( '#dplvar', '$doc noheader' )
mw.logObject(dplvar, "Module:Documentation: dplvar")
if dplvar == '1' then
if badDoc then
f:callParserFunction( '#dplvar:set', '$doc bad', '1' )
end
return
end
local page = mw.title.getCurrentTitle()
local page = mw.title.getCurrentTitle()
Line 76: Line 67:
page = page.basePageTitle
page = page.basePageTitle
end
end
local docPage = mw.title.new( args.page or page.nsText .. ':' .. page.baseText .. '/' .. defaultDocPage )
mw.logObject(docPage, "Module:Documentation: docPage")
mw.logObject(page, "Module:Documentation: page")
if docPage ~= page then return end
local namespace = page.nsText
local namespace = page.nsText
local pageType = mw.ustring.lower( args.type or getType( namespace, page ) )
local pageType = mw.ustring.lower( args.type or getType( namespace, page ) )
Line 81: Line 78:
local body = mw.html.create( 'div' ):addClass( 'documentation-header' )
local body = mw.html.create( 'div' ):addClass( 'documentation-header' )
body
body
:css({
['border-bottom'] = '1px solid #a2a9b1',
['margin-bottom'] = '1em'
})
:addClass( badDoc and 'documentation-badDoc' or '' )
:addClass( badDoc and 'documentation-badDoc' or '' )
:tag( 'div' )
:tag( 'div' )
Line 100: Line 101:
mw.logObject(body, "Module:Documentation: body")
mw.logObject(body, "Module:Documentation: body")
return tostring(body) .. "<hr>"
return tostring(body)
end
end


Line 132: Line 133:
if not docText and not noDoc then
if not docText and not noDoc then
f:callParserFunction( '#dplvar:set', '$doc noheader', '1' )
docText = trim( f:expandTemplate{ title = ':' .. docPage.fullText }  )
docText = trim( f:expandTemplate{ title = ':' .. docPage.fullText }  )
if f:callParserFunction( '#dplvar', '$doc bad' ) == '1' then
badDoc = 1
end
if docText == '' then
if docText == '' then