RuneScape Wiki
mNo edit summary
Tag: sourceedit
No edit summary
Tag: sourceedit
 
(2 intermediate revisions by one other user not shown)
Line 18: Line 18:
 
:tag( 'tr' )
 
:tag( 'tr' )
 
:tag( 'td' )
 
:tag( 'td' )
:wikitext( '[[File:Information icon-grey.svg|40px|Documentation]]' )
+
:css( 'width', '40px' )
  +
:wikitext( '[[File:Information icon-grey.svg|35px|center|link=]]' )
 
:done()
 
:done()
 
:tag( 'td' )
 
:tag( 'td' )
Line 25: Line 26:
 
:done()
 
:done()
 
:tag( 'div' )
 
:tag( 'div' )
:css( 'font-size', '0.85em' )
+
:css({ ['font-size'] = '0.85em', ['line-height'] = '1.4em' })
 
:wikitext( 'It contains usage information, categories, and other content that is not part of the original template page.' )
 
:wikitext( 'It contains usage information, categories, and other content that is not part of the original template page.' )
 
:done()
 
:done()
Line 47: Line 48:
 
 
 
ret2 = mw.html.create( 'div' )
 
ret2 = mw.html.create( 'div' )
:css( {
+
:addClass( 'doc-header' )
['padding-bottom'] = '8px',
 
['padding-top'] = '6px',
 
['border-bottom'] = '1px solid #898989',
 
['margin-bottom'] = '2px'
 
} )
 
 
:tag( 'span' )
 
:tag( 'span' )
:css( {
+
:addClass( 'doc-title' )
['font-weight'] = 'bold',
 
['font-size'] = '125%'
 
} )
 
 
:wikitext( '[[File:Documentation icon.png|32px|link=]] Template documentation' )
 
:wikitext( '[[File:Documentation icon.png|32px|link=]] Template documentation' )
 
:done()
 
:done()
 
:tag( 'span' )
 
:tag( 'span' )
:addClass( 'editsection' )
+
:addClass( 'doc-editlinks' )
 
:addClass( 'plainlinks' )
 
:addClass( 'plainlinks' )
:attr( 'id', 'doc_editlinks' )
+
:wikitext(
 
'[[' .. tostring( mw.uri.fullUrl( template .. '/doc', {action='edit'} ) ) .. ' edit]] ' ..
:tag( 'span' )
 
:addClass( 'small' )
+
'[[' .. tostring( mw.uri.fullUrl( title.fullText, {action='purge'} ) ) .. ' purge]]'
:wikitext(
+
)
'[[' .. tostring( mw.uri.fullUrl( template .. '/doc', {action='edit'} ) ) .. ' edit]] ' ..
 
'[[' .. tostring( mw.uri.fullUrl( title.fullText, {action=purge} ) ) .. ' purge]]' )
 
:done()
 
 
:done()
 
:done()
 
:done()
 
:done()
 
 
 
ret3 = mw.html.create( 'div' )
 
ret3 = mw.html.create( 'div' )
:css( {
+
:addClass( 'doc-transclusion' )
['margin-bottom'] = '25px',
 
['clear'] = 'both',
 
['font-size'] = '85%'
 
} )
 
 
:wikitext( 'This documentation is transcluded from [[' .. template .. '/doc]].' )
 
:wikitext( 'This documentation is transcluded from [[' .. template .. '/doc]].' )
 
:done()
 
:done()

Latest revision as of 02:50, 24 November 2016

Documentation for this module may be created at Module:Documentation/doc

-- <nowiki>
-- [[Template:Documentation]]
--

local p = {}

function p.doc( frame )
    local title = mw.title.getCurrentTitle()
    local args = frame:getParent().args
    local template = args[1] or mw.ustring.gsub( title.fullText, '/doc$', '' )
    local ret, cats, ret1, ret2, ret3
    
    -- subpage header
    if title.subpageText == 'doc' then
        ret = mw.html.create( 'table' )
            :addClass( 'messagebox' )
            :addClass( 'info' )
            :tag( 'tr' )
                :tag( 'td' )
                    :css( 'width', '40px' )
                    :wikitext( '[[File:Information icon-grey.svg|35px|center|link=]]' )
                    :done()
                :tag( 'td' )
                    :tag( 'b' )
                        :wikitext( 'This is a documentation subpage for [[' .. template .. ']].' )
                        :done()
                    :tag( 'div' )
                        :css({ ['font-size'] = '0.85em', ['line-height'] = '1.4em' })
                        :wikitext( 'It contains usage information, categories, and other content that is not part of the original template page.' )
                        :done()
                    :done()
                :done()
            :done()
    
        cats = ''

        if title.nsText == 'Template' then
            cats = '[[Category:Template documentation|' .. title.baseText .. ']]'
        end
        
        return tostring( ret ) .. cats
    end
    
    -- template header
    -- don't use mw.html as we aren't closing the main div tag
    -- @todo when <https://github.com/Wikia/app/pull/7475> is merged, clean this up a bit
    ret1 = '<div class="documentation">'
    
    ret2 = mw.html.create( 'div' )
        :addClass( 'doc-header' )
        :tag( 'span' )
            :addClass( 'doc-title' )
            :wikitext( '[[File:Documentation icon.png|32px|link=]] Template documentation' )
            :done()
        :tag( 'span' )
            :addClass( 'doc-editlinks' )
            :addClass( 'plainlinks' )
            :wikitext(
                '[[' .. tostring( mw.uri.fullUrl( template .. '/doc', {action='edit'} ) ) .. ' edit]] ' ..
                '[[' .. tostring( mw.uri.fullUrl( title.fullText, {action='purge'} ) ) .. ' purge]]'
            )
            :done()
        :done()
        
    ret3 = mw.html.create( 'div' )
        :addClass( 'doc-transclusion' )
        :wikitext( 'This documentation is transcluded from [[' .. template .. '/doc]].' )
        :done()
        
    return ret1 .. tostring( ret2 ) .. tostring( ret3 )
end

return p