Jump to content

Module:Cite LADOTD map: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Created module
(No difference)

Revision as of 13:43, 5 June 2017

local p = { } --Package to be exported

function p.url(frame)
	--This function builds URLs.
	local pframe = frame:getParent() --get arguments passed to the template
	local args = pframe.args
	local parish = args['parish'] or '' --this string holds the raw parish name
	local parishProcessed --this string holds the processed parish name to be added to the URL
	
	--Various parishes need special treatment to handle spaces and/or punctuation.
	if parish == "East Baton Rouge" then
		parishProcessed = "EastBatonRouge"
	elseif parish == "East Carroll" then
		parishProcessed = "EastCarroll"
	elseif parish == "East Feliciana" then
		parishProcessed = "EastFeliciana"
	elseif parish == "Jefferson Davis" then
		parishProcessed = "JeffersonDavis"
	elseif parish == "La Salle" then
		parishProcessed = "LaSalle"
	elseif parish == "Pointe Coupee" then
		parishProcessed = "Pointe Coupee"
	elseif parish == "Red River" then
		parishProcessed = "RedRiver"
	elseif parish == "St. Bernard" then
		parishProcessed = "StBernard"
	elseif parish == "St. Charles" then
		parishProcessed = "StCharles"
	elseif parish == "St. Helena" then
		parishProcessed = "StHelena"
	elseif parish == "St. James" then
		parishProcessed = "StJames"
	elseif parish == "St. John the Baptist" then
		parishProcessed = "StJohntheBaptist"
	elseif parish == "St. Landry" then
		parishProcessed = "StLandry"
	elseif parish == "St. Martin" then
		parishProcessed = "StMartin"
	elseif parish == "St. Mary" then
		parishProcessed = "StMary"
	elseif parish == "St. Tammany" then
		parishProcessed = "StTammany"
	elseif parish == "West Baton Rouge" then
		parishProcessed = "WestBatonRouge"
	elseif parish == "West Carroll" then
		parishProcessed = "WestCarroll"
	elseif parish == "West Feliciana" then
		parishProcessed = "WestFeliciana"
	else
		parishProcessed = parish
	end
	
	local date = p.date(frame)
	if date == "2012P" then
		return "http://wwwsp.dotd.la.gov/Inside_LaDOTD/Divisions/Multimodal/Data_Collection/Mapping/Parish%20Maps/" .. parishProcessed
	end
end

return p