Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
P1NK AN1MAL C00K13 G1RAFF3 PLUSH13
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:Navpills
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Page information
Cargo data
Appearance
move to sidebar
hide
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 mArguments --initialize lazily local p = {} -- Returns a table containing the numbers of the arguments that exist -- for the specified prefix. For example, if the prefix was 'data', and -- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}. local function getArgNums(prefix, args) local nums = {} for k, v in pairs(args) do local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end --Implements {{Navpills}} from the frame function p.navpills( frame ) mArguments = require( 'Module:Arguments' ) return p._navpills( mArguments.getArgs( frame ) ) end function p._navpills( args ) if not args then return 'Missing arguments' end local html = mw.html.create( 'div' ):addClass( 'template-navpills' ):attr( 'role', 'navigation' ) for i, _ in ipairs( getArgNums( 'page', args ) ) do if not args[ 'page' .. i ] then return end local num = tostring( i ) local navpill = mw.html.create('div'):addClass('template-navpill') if args[ 'image' .. i ] then navpill:tag('div'):addClass('template-navpill-background') :wikitext( string.format( '[[File:%s|x48px|link=]]', args[ 'image' .. num ] ) ) end navpill:wikitext( string.format( '[[%s|%s]]', args[ 'page' .. num ], args[ 'text' .. num ] or args[ 'page' .. num ] ) ) html:node(navpill) end return mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = 'Module:Navpills/styles.css' } } .. tostring( html ) end return p
Summary:
Please note that all contributions to P1NK AN1MAL C00K13 G1RAFF3 PLUSH13 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
My wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Page included on this page:
Module:Navpills/doc
(
edit
)
Search
Search
Editing
Module:Navpills
Add topic