Module:Pagination/previous
Appearance
local p = {}
local getArgs = require('Module:Arguments').getArgs
local function err(msg)
return mw.ustring.format('<strong class="error">%s ([[Template:Pagination#Errors|help]])</strong>', msg)
end
function p.getPreviousButton(frame)
local args = getArgs(frame) -- for templates only
return p._getPreviousButton(args)
end
function p._getPreviousButton(args) -- for modules only
link = args[1] or args.link
style = args.style or ";"
if link then
return mw.ustring.format(mw.getCurrentFrame():extensionTag('templatestyles', {src='Module:Pagination/styles.css'}) .. '<span class="prev-btn" style="%s;">[[:%s|Previous]]</span>', style, link)
elseif not link then
return err('PaginationScriptError: parameter for the previous button link not found, got: nil')
elseif link == '' then
return err('PaginationScriptError: a link must be provided for the previous button')
end
end
return p