Site notice |
---|
Welcome! Please check To-Do List to see what pages need help, who is working on what, etc.
|
Difference between revisions of "Module:PrevNext"
From Mega Man Wiki
Line 9: | Line 9: | ||
function p._prevnext(args, options) | function p._prevnext(args, options) | ||
if | if args["type"] ~= nil then | ||
type = | type = args["type"] | ||
end | end | ||
if | if args["prev"] ~= nil then | ||
prev = "<--" . | prev = "<--" .. args["prev"] | ||
else | else | ||
prev = "First " .. type | prev = "First " .. type | ||
end | end | ||
if | if args["next"] ~= nil then | ||
next = | next = args["next"] .. "-->" | ||
else | else | ||
next = "Last " .. type | next = "Last " .. type | ||
end | end | ||
if | if args["series"] ~= nil then | ||
series = | series = args["series"] | ||
end | end | ||
local prev_cell = mw.html.create( 'td' ) | local prev_cell = mw.html.create( 'td' ) |
Revision as of 19:54, 8 May 2020
Documentation for this module may be created at Module:PrevNext/doc
local p = {} --p stands for package
function p.prevnext(frame)
-- A passthrough that gets args from the frame and all
mArguments = require('Module:Arguments')
args = mArguments.getArgs(frame)
return p._prevnext(args)
end
function p._prevnext(args, options)
if args["type"] ~= nil then
type = args["type"]
end
if args["prev"] ~= nil then
prev = "<--" .. args["prev"]
else
prev = "First " .. type
end
if args["next"] ~= nil then
next = args["next"] .. "-->"
else
next = "Last " .. type
end
if args["series"] ~= nil then
series = args["series"]
end
local prev_cell = mw.html.create( 'td' )
td
:css( 'width', '33%' )
:wikitext( prev )
local series_cell = mw.html.create( 'th' )
th
:wikitext( series )
local next_cell = mw.html.create( 'td' )
td
:css( 'width', '33%' )
:wikitext( next )
local row = mw.html.create( 'tr' )
tr
:wikitext( prev_cell .. series_cell .. next_cell )
local t = mw.html.create( 'table' )
table
:css( 'width', '100%' )
:wikitext( row )
return tostring( t )
end
return p