Module:Shortcut

From RuneRealm Wiki

This is the current revision of this page, as edited by Alex (talk | contribs) at 23:36, 15 October 2024 (Created page with "local p = {} function p.main(frame) local args = frame:getParent().args return p._main(args) end function p._main(args) local div = mw.html.create('div') :addClass('shortcut noprint plainlist') :wikitext('Shortcut') local numargs = 0 for i, v in ipairs(args) do numargs = numargs + 1 end if numargs > 1 then div:node('s') end div:node(':') local list = div:tag('ul')..."). The present address (URL) is a permanent link to this version.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Module documentation
This documentation is transcluded from Template:No documentation/doc. [edit] [history] [purge]
This module does not have any documentation. Please consider adding documentation at Module:Shortcut/doc. [edit]
Module:Shortcut's function main is invoked by Template:Shortcut.

local p = {}

function p.main(frame)
    local args = frame:getParent().args
    return p._main(args)
end

function p._main(args)
    local div = mw.html.create('div')
        :addClass('shortcut noprint plainlist')
        :wikitext('[[RuneScape:Shortcut|Shortcut]]')

    local numargs = 0
    for i, v in ipairs(args) do
        numargs = numargs + 1
    end    

    if numargs > 1 then
        div:node('s')
    end
    div:node(':')

    local list = div:tag('ul')
    for i, v in ipairs(args) do
        list:tag('li'):wikitext('[[' .. v .. ']]')
    end

    return tostring(div)
end

--[[ DEBUG COPYPASTA
= p._main({'Link 1', 'Link 2', 'Link 3', 'Link 4'})
--]]

return p