FANDOM


-- Adapted from Runescape Wiki
-- See talk page for more info
 
local p = {}
 
function p.doc( frame )
    local title = mw.title.getCurrentTitle()
    local template = mw.ustring.gsub( title.fullText, '/doc$', '' )
    local ret, cats, ret1, ret2, ret3
 
    -- subpage header
    if title.subpageText == 'doc' then
        ret = mw.html.create( 'table' )
            :css({
                ['background-color'] = '#0f8687a6',
                ['width'] = '65%',
                ['margin'] = '0.5em auto 1.9em',
                ['padding 3px'] = 'px 3px 0',
                ['border-left'] = '15px solid #203f66',
                ['box-shadow'] = '-8px 8px 5px #00000047',
            })
            :tag( 'tr' )
                :tag( 'td' )
                    :css( 'width', '40px' )
                    :wikitext( '[[File:Construction Sign small.png|50px|center|link=]]' )
                    :done()
                :tag( 'td' )
                    :tag( 'b' )
                        :wikitext( 'This is a documentation subpage for <u>[[' .. template .. ']]</u>.' )
                        :css('color', 'rgb(255, 215, 0)')
                        :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.' )
                        :css('color', '#D5D4D4')
                        :done()
                    :done()
                :done()
            :done()
 
        cats = ''
 
        if title.nsText == 'Template' then
            cats = '[[Category:Template documentation|' .. title.baseText .. ']]'
        end
 
        return tostring( ret ) .. cats
    end
 
    -- template header
    ret1 = '<div style="background-color:#0c16246e;color:#D5D4D4;border-left: 15px solid #080f19e6;margin-top: 1em;padding: 5px 15px;border-radius: 6px;">'
 
    ret2 = mw.html.create( 'div' )
        :css({
            ['border-bottom'] = '1px solid #898989',
            ['margin-bottom'] = '2px',
            ['padding'] = '6px 0 8px'
        })
        :tag( 'span' )
            :wikitext( '[[File:Book Pile Top_small.png|50px|link=]] Template documentation' )
            :css({
                ['font-size'] = '1.25em',
                ['font-weight'] = 'bold' 
            })
            :done()
        :tag( 'span' )
            :wikitext(
                '[[' .. tostring( mw.uri.fullUrl( template .. '/doc', {action='edit'} ) ) .. ' edit]] ' ..
                '[[' .. tostring( mw.uri.fullUrl( title.fullText, {action='purge'} ) ) .. ' purge]]'
            )
            :css({
                ['font-size'] = '0.85em',
                ['margin-left'] = '10px'
            })
            :done()
        :done()
 
    ret3 = mw.html.create( 'div' )
        :wikitext( 'This documentation is transcluded from [[' .. template .. '/doc]].' )
        :css({
            ['clear'] = 'both',
            ['font-size'] = '0.85em',
            ['margin-bottom'] = '15px'    
        })
 
    return ret1 .. tostring( ret2 ) .. tostring( ret3 )
end
 
return p
Community content is available under CC-BY-SA unless otherwise noted.