Module:Documentation

-- local dependencyList = require( 'Module:DependencyList' ) local yn = require( 'Module:Yesno' ) local p = {}

function p.doc( frame ) local title = mw.title.getCurrentTitle local args = frame:getParent.args local page = args[1] or mw.ustring.gsub( title.fullText, '/doc$', '' ) local addDependencyList = yn( args.DependencyList or true ) local addModuleToc = yn( args.ModuleToc or true ) local isDataModule = yn( args.isData or false ) local ret, cats, ret1, ret2, ret3 local onModule = title.namespace == 828 local opts = frame.args; local preamble = opts.preamble; -- subpage header if title.subpageText == 'doc' then ret = mw.html.create( nil ) :tag( 'div' ) :addClass( 'mbox mbox-low mbox-documentationsub' ) :attr( 'role', 'presentation' ) :tag( 'span' ) :addClass( 'mbox-title' ) :tag( 'span' ) :addClass( 'mbox-icon metadata' ) :wikitext( '' ) :done :wikitext( 'This is a documentation subpage for ' .. page .. '.' ) :done :tag( 'span' ) :addClass( 'mbox-text' ) :wikitext(                       string.format( 'It contains usage information, categories, and other content that is not part of the original %s page.', onModule and 'module' or 'template' )                   )                    :done :done :wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = 'Mbox/styles.css'} }) :done

if title.namespace == 10 then -- Template namespace cats = '' ret2 = addDependencyList and dependencyList._main or '' elseif title.namespace == 828 then -- Module namespace cats = '' ret2 = addDependencyList and dependencyList._main or '' ret2 = ret2 .. (addModuleToc and require('Module:Module toc').main or '') else cats = '' ret2 = '' end

if isDataModule and title.namespace == 828 then ret2 = ret2..' compatible ' end

if (preamble and preamble ~= "") then ret2 = preamble .. ret2 end

return tostring( ret ) .. ret2 .. cats end -- template header -- don't use mw.html as we aren't closing the main div tag ret1 = ' '

ret2 = mw.html.create( nil ) :tag( 'div' ) :addClass( 'documentation-header' ) :tag( 'span' ) :addClass( 'documentation-title' ) :wikitext( string.format('%s documentation', onModule and 'Module' or 'Template') ) :done :tag( 'span' ) :addClass( 'documentation-links plainlinks' ) :wikitext(                    .. tostring( mw.uri.fullUrl( page .. '/doc', {action='view'} ) ) .. ' view' ..                     .. tostring( mw.uri.fullUrl( page .. '/doc', {action='edit'} ) ) .. ' edit' ..                    '' .. tostring( mw.uri.fullUrl( page .. '/doc', {action='history'} ) ) .. ' history' ..                    '[ [' .. tostring( mw.uri.fullUrl( title.fullText, {action='purge'} ) ) .. ' purge] ]'                ) :done :done :tag( 'div' ) :addClass( 'documentation-subheader' ) :tag( 'span' ) :addClass( 'documentation-documentation' ) :wikitext( 'This documentation is transcluded from ' .. page .. '/doc. Changes can be proposed in the talk page.' ) :done :wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = 'Mbox/styles.css'} }) :wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = 'Documentation/styles.css'} }) :done ret3 = addDependencyList and dependencyList._main(nil, args.category, args.isUsed) or '' if title.namespace == 828 then ret3 = ret3 .. (addModuleToc and require('Module:Module toc').main or '') end if isDataModule and title.namespace == 828 then ret3 = ret3..' compatible ' end

if (preamble and preamble ~= "") then ret3 = preamble .. ret3 end return ret1 .. tostring( ret2 ) .. ' ' .. ret3 end

return p

--