Module:Sandbox/Bility/Shortcut

local p = {}

-- shortcut box code generator function shortcut(sCuts, sType) local wikicode = ' ' local wikilist = '' local shortName = 'Shortcut'   if sType == 3 then shortName = '[[Wikipedia:Policies and guidelines|Policy shortcut' end    local alignStyle = 'float: right; '    local alignClass =     if sType == 4 then        alignStyle = 'float: left; '        alignClass = 'shortcutbox-left '    end    local linkcount = 0    for i in ipairs(sCuts) do        if sCuts[i] ~=  and mw.title.new(sCuts[i]).id ~= 0 then            wikicode = wikicode .. ' '            wikilist = wikilist .. '[[' .. sCuts[i] .. ''            linkcount = linkcount + 1        end    end    if linkcount == 0 then        return nil    end    if sType == 2 then wikilist = ' ' .. wikilist .. ' ' end    wikicode = wikicode .. ' \n'    wikicode = wikicode .. ' '    return wikicode end

-- normal vertical list of shortcuts function p.vertical(frame) return shortcut(frame.args, 1)-- or '' end

-- horizontal list of shortcuts function p.horizontal(frame) return shortcut(frame.args, 2)-- or '' end

-- list of policy shortcuts function p.policy(frame) return shortcut(frame.args, 3)-- or '' end

-- left-aligned list of shortcuts function p.left(frame) return shortcut(frame.args, 4)-- or '' end

return p