Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Bility/Shortcut
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} -- shortcut box code generator function shortcut(sCuts, sType) local wikicode = '<div style="position: relative; top: -3em;">' local wikilist = '<ul>' local shortName = '[[Wikipedia:Shortcut|Shortcut' if sType == 3 then shortName = '[[Wikipedia:Policies and guidelines|Policy]] [[Wikipedia:Shortcut|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 .. '<span id="{{anchorencode:' .. sCuts[i] .. '}}"></span>' wikilist = wikilist .. '<li>[[' .. sCuts[i] .. ']]</li>' linkcount = linkcount + 1 end end if linkcount == 0 then return nil end if sType == 2 then wikilist = '<div class="hlist">' .. wikilist .. '</div>' end wikicode = wikicode .. '</div>\n' wikicode = wikicode .. '<table class="shortcutbox ' .. alignClass .. 'noprint" style="' .. alignStyle .. 'border: 1px solid #aaa; background: #fff; margin: .3em .3em .3em 1em; padding: 3px; text-align: center;"><tr><th style="border: none; background: transparent;" class="plainlist">' wikicode = wikicode .. '<small>' .. shortName if linkcount > 1 then wikicode = wikicode .. 's' end wikicode = wikicode .. ']]' .. wikilist .. '</ul></small></th></tr></table>' return wikicode end -- normal vertical list of shortcuts function p.vertical(frame) return shortcut(frame.args, 1)-- or '[[Category:Wikipedia shortcut box first parameter needs fixing|{{PAGENAME}}]]' end -- horizontal list of shortcuts function p.horizontal(frame) return shortcut(frame.args, 2)-- or '[[Category:Wikipedia shortcut box first parameter needs fixing|{{PAGENAME}}]]' end -- list of policy shortcuts function p.policy(frame) return shortcut(frame.args, 3)-- or '[[Category:Wikipedia shortcut box first parameter needs fixing|{{PAGENAME}}]]' end -- left-aligned list of shortcuts function p.left(frame) return shortcut(frame.args, 4)-- or '[[Category:Wikipedia shortcut box first parameter needs fixing|{{PAGENAME}}]]' end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/Bility/Shortcut/doc
(
edit
)