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
m |
|||
(11 intermediate revisions by 2 users not shown) | |||
Line 9: | Line 9: | ||
function p._prevnext(args, options) | function p._prevnext(args, options) | ||
if args["prev"] ~= nil then | if args["prev"] ~= nil then | ||
prev = "<--" .. args["prev"] | prev = "<-- " .. args["prev"] | ||
else | else | ||
prev = "First " | prev = "First of the series" | ||
end | end | ||
if args["next"] ~= nil then | if args["next"] ~= nil then | ||
next = args["next"] .. "-->" | next = args["next"] .. " -->" | ||
else | else | ||
next = "Last " | next = "Last of the series" | ||
end | end | ||
Line 31: | Line 25: | ||
end | end | ||
local prev_cell = mw.html.create( 'td' ) | |||
:css( 'width', '33%' ) | :css( 'width', '33%' ) | ||
:wikitext( prev ) | :wikitext( prev ) | ||
local series_cell = mw.html.create( 'th' ) | local series_cell = mw.html.create( 'th' ) | ||
:wikitext( series ) | :wikitext( series ) | ||
local next_cell = mw.html.create( 'td' ) | local next_cell = mw.html.create( 'td' ) | ||
:css( 'width', '33%;' ) | |||
:css( 'width', '33%' ) | :css( 'text-align', 'end;') | ||
:wikitext( next ) | :wikitext( next ) | ||
local row = mw.html.create( 'tr' ) | local row = mw.html.create( 'tr' ) | ||
:wikitext( tostring(prev_cell) .. tostring(series_cell) .. tostring(next_cell) ) | |||
:wikitext( prev_cell .. series_cell .. next_cell ) | |||
local t = mw.html.create( 'table' ) | local t = mw.html.create( 'table' ) | ||
t:addClass( "wikitable") | |||
:css( 'width', '100%' ) | t:css( 'width', '100%' ) | ||
:wikitext( row ) | t:css( 'margin-bottom', '0px;') | ||
t:css( 'margin-top', '0px;') | |||
t:wikitext( tostring(row) ) | |||
return tostring( t ) | return tostring( t ) |
Latest revision as of 17:04, 25 June 2021
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["prev"] ~= nil then
prev = "<-- " .. args["prev"]
else
prev = "First of the series"
end
if args["next"] ~= nil then
next = args["next"] .. " -->"
else
next = "Last of the series"
end
if args["series"] ~= nil then
series = args["series"]
end
local prev_cell = mw.html.create( 'td' )
:css( 'width', '33%' )
:wikitext( prev )
local series_cell = mw.html.create( 'th' )
:wikitext( series )
local next_cell = mw.html.create( 'td' )
:css( 'width', '33%;' )
:css( 'text-align', 'end;')
:wikitext( next )
local row = mw.html.create( 'tr' )
:wikitext( tostring(prev_cell) .. tostring(series_cell) .. tostring(next_cell) )
local t = mw.html.create( 'table' )
t:addClass( "wikitable")
t:css( 'width', '100%' )
t:css( 'margin-bottom', '0px;')
t:css( 'margin-top', '0px;')
t:wikitext( tostring(row) )
return tostring( t )
end
return p