Module:Infobox road/sandbox

This is an old revision of this page, as edited by Fredddie (talk | contribs) at 07:16, 13 February 2021. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local p = {}
local getArgs = require('Module:Arguments').getArgs
local roadDataModule = require("Module:Road data")
local util = require("Module:Road data/util")

function p.headerStyle(frame)
	local args = getArgs(frame)
	local deleted = args.decommissioned or args.deleted or args.former
	if deleted then
		return "background:#AAA;"
	end
	local uc = args["under construction"] or args.const or args.uc
	if uc then
		return "background:#fc6"
	end
	local hist = args.hist or args.historic or args.historical
	if hist then
		return "background:#704214; color:#fff;"
	end
	local colors = require"Module:Infobox road/color/sandbox"
	
	local header = args.header_type
	
	local function colour(args)
		if header == deleted then
			return deleted
		elseif header == uc then
			return uc
		elseif header == hist then
			return hist
		else return colors.header(frame)
		end
	end
end

local function browse(args)
	local previousRoute = args.previous_route
	local nextRoute = args.next_route
	local extended = args.browse
		local box = mw.html.create('table'):cssText("width:100%; background:none; border-collapse:collapse")
		if previousRoute or nextRoute then
			local boxModule = require "Module:Road data/browse/sandbox" -- remove "/sandbox" when live!
			local primary = boxModule._browse(args)
			box:wikitext(primary)
		end
		if extended then
			box:wikitext(extended)
		end
		return tostring(box)
end

function p.browse(frame)
	local args = getArgs(frame)
	return browse(args)
end

return p