Editing Module:Documentation

Warning: You are not logged in. Once you make an edit, a temporary account will be created for you. Learn more. Log in or create an account to continue receiving notifications after this account expires, and to access other features.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
-- <nowiki>
-- <nowiki>
local dependencyList = require( 'Module:DependencyList' )
-- [[Template:Documentation]]
local yn = require( 'Module:Yesno' )
--
 
local p = {}
local p = {}


Line 7: Line 8:
     local title = mw.title.getCurrentTitle()
     local title = mw.title.getCurrentTitle()
     local args = frame:getParent().args
     local args = frame:getParent().args
     local page = args[1] or mw.ustring.gsub( title.fullText, '/doc$', '' )
     local template = args[1] or mw.ustring.gsub( title.fullText, '/doc$', '' )
    local addDependencyList = yn( args.DependencyList or true )
     local ret, cats, ret1, ret2, ret3
     local ret, cats, ret1, ret2, ret3
    local onModule = title.namespace == 828
      
      
     -- subpage header
     -- subpage header
Line 19: Line 18:
             :tag( 'tr' )
             :tag( 'tr' )
                 :tag( 'td' )
                 :tag( 'td' )
                    :css( 'width', '40px' )
                     :wikitext( '[[File:Information icon-grey.svg|40px|Documentation]]' )
                     :wikitext( '[[File:Information icon-grey.svg|35px|centre|link=]]' )
                     :done()
                     :done()
                 :tag( 'td' )
                 :tag( 'td' )
                     :tag( 'b' )
                     :tag( 'b' )
                         :wikitext( 'This is a documentation subpage for [[' .. page .. ']].' )
                         :wikitext( 'This is a documentation subpage for [[' .. template .. ']].' )
                         :done()
                         :done()
                     :tag( 'div' )
                     :tag( 'div' )
                         :css({ ['font-size'] = '0.85em', ['line-height'] = '1.4em' })
                         :css( 'font-size', '0.85em' )
                         :wikitext(
                         :wikitext( 'It contains usage information, categories, and other content that is not part of the original template page.' )
                        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()
                     :done()
                     :done()
                 :done()
                 :done()
             :done()
             :done()
   
        cats = ''


         if title.namespace == 10 then -- Template namespace
         if title.nsText == 'Template' then
             cats = '[[Category:Template documentation|' .. title.baseText .. ']]'
             cats = '[[Category:Template documentation|' .. title.baseText .. ']]'
            ret2 = addDependencyList and dependencyList._main(nil, args.category, args.isUsed) or ''
        elseif title.namespace == 116 then -- Calculator namespace
        cats = ''
        ret2 = addDependencyList and dependencyList._main(nil, args.category, args.isUsed) or ''
        elseif title.namespace == 828 then -- Module namespace
        cats = '[[Category:Module documentation|' .. title.baseText .. ']]'
        ret2 = addDependencyList and dependencyList._main(nil, args.category, args.isUsed) or ''
        else
        cats = ''
        ret2 = ''
         end
         end
          
          
         return tostring( ret ) .. ret2 .. cats
         return tostring( ret ) .. cats
     end
     end
      
      
     -- template header
     -- template header
     -- don't use mw.html as we aren't closing the main div tag
     -- don't use mw.html as we aren't closing the main div tag
     ret1 = '<div class="documentation" style="clear:both;">'
    -- @todo when <https://github.com/Wikia/app/pull/7475> is merged, clean this up a bit
 
     ret1 = '<div class="documentation">'
     ret2 = mw.html.create( nil )
   
        :tag( 'div' )
     ret2 = mw.html.create( 'div' )
            :addClass( 'doc-header documentation-header')
        :addClass( 'doc-header' )
            :tag( 'span' )
        :tag( 'span' )
            :addClass( 'doc-title documentation-title' )
            :addClass( 'doc-title' )
            :wikitext( string.format('%s documentation', onModule and 'Module' or 'Template') )
            :wikitext( 'Template documentation' )
            :done()
             :done()
             :done()
         :tag( 'div' )
         :tag( 'span' )
             :addClass( 'doc-transclusion documentation-subheader' )
             :addClass( 'doc-editlinks' )
             :tag( 'span' )
             :addClass( 'plainlinks' )
            :addClass( 'documentation-documentation' )
             :wikitext(
            :wikitext( 'This documentation is transcluded from [[' .. page .. '/doc]]. ' )
                '[[' .. tostring( mw.uri.fullUrl( template .. '/doc', {action='edit'} ) ) .. ' edit]] ' ..
            :done()
                '[<span class="jsPurgeLink">[' .. tostring( mw.uri.fullUrl( title.fullText .. '/doc', {action='purge'} ) ) .. ' purge]</span>]'
             :tag( 'span' )
            )
            :addClass( 'doc-editlinks documentation-links plainlinks' )
            :wikitext(
            '[[' .. tostring( mw.uri.fullUrl( page .. '/doc', {action='edit'} ) ) .. ' edit]] ' ..
            '[[' .. tostring( mw.uri.fullUrl( page .. '/doc', {action='history'} ) ) .. ' history]] ' ..
                '[<span class="jsPurgeLink">[' .. tostring( mw.uri.fullUrl( title.fullText, {action='purge'} ) ) .. ' purge]</span>]'
            )
            :done()
             :done()
             :done()
   
        :done()
     ret3 = addDependencyList and dependencyList._main(nil, args.category, args.isUsed) or ''
       
     ret3 = mw.html.create( 'div' )
        :addClass( 'doc-transclusion' )
        :wikitext( 'This documentation is transcluded from [[' .. template .. '/doc]].' )
        :done()
          
          
     return ret1 .. tostring( ret2 ) .. '<div class="documentation-content">' .. ret3
     return ret1 .. tostring( ret2 ) .. tostring( ret3 )
end
end


return p
return p
-- </nowiki>
Please note that all contributions to The Deadlock Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see Deadlock:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Preview page with this template

Page included on this page: