Modiwl:Chapter navigation

Documentation for this module may be created at Modiwl:Chapter navigation/doc

return {
	navigation_bar = function(frame)
		local current_title = mw.title.getCurrentTitle()
		local base_page_name = current_title.baseText
		if frame.args.bordertopstyle == null then frame.args.bordertopstyle = '' end
		if frame.args.bordertopwidth == null then frame.args.bordertopwidth = '' end
		if frame.args.borderbottomstyle == null then frame.args.borderbottomstyle = '' end
		if frame.args.borderbottomwidth == null then frame.args.borderbottomwidth = '' end
		local bar = mw.html.create('div')
			:addClass('noprint')
			:css {
				['border-top-style'] = frame.args.bordertopstyle;
				['border-top-width'] = frame.args.bordertopwidth;
				['border-bottom-style'] = frame.args.borderbottomstyle;
				['border-bottom-width'] = frame.args.borderbottomwidth;
				clear = 'both';
				['margin-top'] = "1em";
				['margin-bottom'] = "1em";
				width = "100%";
				height = "20px";
			}
		if frame.args.previous and frame.args.previous ~= '' then
			bar:tag('span'):css('float', 'left'):wikitext('[[' .. base_page_name .. '/' .. frame.args.previous .. '|' .. frame.args.previous .. ']]')
		end
		if frame.args.next and frame.args.next ~= '' then
			bar:tag('span'):css('float', 'right'):wikitext('[[' .. base_page_name .. '/' .. frame.args.next .. '|' .. frame.args.next .. ']]')
		end
		return tostring(bar)
	end;
	categorize = function(frame)
		--local current_title = mw.title.getCurrentTitle()
		--return "[[Category:" .. current_title.baseText .. '|' .. current_title.subpageText .. ']]'
                return frame:expandTemplate{title = "BookCat"}
	end
}