Fandom

Old School RuneScape Wiki

Module:Documentation

16,266pages on
this wiki
Add New Page
Discuss0
-- <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' )
                    :wikitext( '[[File:Information icon-grey.svg|40px|Documentation]]' )
                    :done()
                :tag( 'td' )
                    :tag( 'b' )
                        :wikitext( 'This is a documentation subpage for [[' .. template .. ']].' )
                        :done()
                    :tag( 'div' )
                        :css( 'font-size', '0.85em' )
                        :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( '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 .. '/doc', {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

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki