<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.tachyony.co.uk/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AJcon</id>
	<title>Module:Jcon - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.tachyony.co.uk/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AJcon"/>
	<link rel="alternate" type="text/html" href="https://wiki.tachyony.co.uk/w/index.php?title=Module:Jcon&amp;action=history"/>
	<updated>2026-05-15T12:55:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.5</generator>
	<entry>
		<id>https://wiki.tachyony.co.uk/w/index.php?title=Module:Jcon&amp;diff=8997&amp;oldid=prev</id>
		<title>Tachyony: Created page with &quot;local p = {} local getArgs = require(&#039;Module:Arguments&#039;).getArgs local yesno = require(&#039;Module:Yesno&#039;) local data = mw.loadData(&#039;Module:Jcon/data&#039;)  -- Generate the wikitext for the shield local function shieldWikitext(route, roadInfo, args) 	local size = args.size or &#039;20px&#039; -- Image size  	local fileName 	local titleObj 	 	if roadInfo.prefix == &#039;Ontario&#039; and (tonumber(({route:gsub(&#039;%D&#039;, &#039;&#039;)})[1]) or 0) &gt;= 500 then -- Exception for secondary and tertiary highways 		fileN...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.tachyony.co.uk/w/index.php?title=Module:Jcon&amp;diff=8997&amp;oldid=prev"/>
		<updated>2022-01-20T02:39:26Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local p = {} local getArgs = require(&amp;#039;Module:Arguments&amp;#039;).getArgs local yesno = require(&amp;#039;Module:Yesno&amp;#039;) local data = mw.loadData(&amp;#039;Module:Jcon/data&amp;#039;)  -- Generate the wikitext for the shield local function shieldWikitext(route, roadInfo, args) 	local size = args.size or &amp;#039;20px&amp;#039; -- Image size  	local fileName 	local titleObj 	 	if roadInfo.prefix == &amp;#039;Ontario&amp;#039; and (tonumber(({route:gsub(&amp;#039;%D&amp;#039;, &amp;#039;&amp;#039;)})[1]) or 0) &amp;gt;= 500 then -- Exception for secondary and tertiary highways 		fileN...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
local getArgs = require(&amp;#039;Module:Arguments&amp;#039;).getArgs&lt;br /&gt;
local yesno = require(&amp;#039;Module:Yesno&amp;#039;)&lt;br /&gt;
local data = mw.loadData(&amp;#039;Module:Jcon/data&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
-- Generate the wikitext for the shield&lt;br /&gt;
local function shieldWikitext(route, roadInfo, args)&lt;br /&gt;
	local size = args.size or &amp;#039;20px&amp;#039; -- Image size&lt;br /&gt;
&lt;br /&gt;
	local fileName&lt;br /&gt;
	local titleObj&lt;br /&gt;
	&lt;br /&gt;
	if roadInfo.prefix == &amp;#039;Ontario&amp;#039; and (tonumber(({route:gsub(&amp;#039;%D&amp;#039;, &amp;#039;&amp;#039;)})[1]) or 0) &amp;gt;= 500 then -- Exception for secondary and tertiary highways&lt;br /&gt;
		fileName = &amp;#039;Ontario Highway &amp;#039; .. route .. &amp;#039;.svg&amp;#039;&lt;br /&gt;
	elseif roadInfo.prefix == &amp;#039;Ontario&amp;#039; and route:gsub(&amp;#039;%s+&amp;#039;, &amp;#039;&amp;#039;):upper() == &amp;#039;407ETR&amp;#039; then -- Exception for 407 ETR&lt;br /&gt;
		fileName = yesno(args.shield) and &amp;#039;407 Express Toll Route Traffic Sign.svg&amp;#039; or &amp;#039;Highway407crest.svg&amp;#039;&lt;br /&gt;
	elseif roadInfo.shield and yesno(args.shield) then -- Shield format (used as reassurance marker)&lt;br /&gt;
		fileName = roadInfo.shield:format(route)&lt;br /&gt;
	elseif roadInfo.guide then -- Guide format (used on guide signs)&lt;br /&gt;
		fileName = roadInfo.guide:format(route)&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;#039;&amp;#039; -- Return nothing if no file format was found&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	titleObj = mw.title.new(&amp;#039;File:&amp;#039; .. fileName)&lt;br /&gt;
&lt;br /&gt;
	if not titleObj or not titleObj.file.exists then&lt;br /&gt;
		return &amp;#039;&amp;#039; -- Return nothing if no existing file was found&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return &amp;#039;[[File:&amp;#039; .. fileName .. &amp;#039;|alt=|link=|&amp;#039; .. size .. &amp;#039;]]&amp;#039; -- Return the file wikitext&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Generate the text part of the output&lt;br /&gt;
local function getText(route, roadInfo, args)&lt;br /&gt;
	local link = &amp;#039;&amp;#039;&lt;br /&gt;
	local display = &amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
	if roadInfo.prefix == &amp;#039;Ontario&amp;#039; and route:gsub(&amp;#039;%s+&amp;#039;, &amp;#039;&amp;#039;):upper() == &amp;#039;407ETR&amp;#039; then -- Exception for the 407 ETR&lt;br /&gt;
		link = &amp;#039;Ontario Highway 407&amp;#039;&lt;br /&gt;
		display = &amp;#039;407 ETR&amp;#039;&lt;br /&gt;
	elseif roadInfo.prefix == &amp;#039;Ontario&amp;#039; and route:upper() == &amp;#039;QEW&amp;#039; then -- Exception for the QEW&lt;br /&gt;
		link = &amp;#039;Queen Elizabeth Way&amp;#039;&lt;br /&gt;
		display = &amp;#039;Queen Elizabeth Way&amp;#039;&lt;br /&gt;
	elseif roadInfo.prefix == &amp;#039;Toronto&amp;#039; and route:upper() == &amp;#039;DVP&amp;#039; then -- Exception for the DVP&lt;br /&gt;
		link = &amp;#039;Don Valley Parkway&amp;#039;&lt;br /&gt;
		display = &amp;#039;Don Valley Parkway&amp;#039;&lt;br /&gt;
	elseif roadInfo.prefix == &amp;#039;Toronto&amp;#039; and route == &amp;#039;Gardiner&amp;#039; then -- Exception for the Gardiner Expressway&lt;br /&gt;
		link = &amp;#039;Gardiner Expressway&amp;#039;&lt;br /&gt;
		display = &amp;#039;Gardiner Expressway&amp;#039;&lt;br /&gt;
	else&lt;br /&gt;
		link = roadInfo.prefix .. &amp;#039; &amp;#039; .. roadInfo.type .. &amp;#039; &amp;#039; .. route&lt;br /&gt;
		display = roadInfo.type .. &amp;#039; &amp;#039; .. route&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local titleObj = mw.title.new(link)&lt;br /&gt;
	&lt;br /&gt;
	if (((titleObj and titleObj.exists) or yesno(args.showred)) and not yesno(args.nolink)) then -- Check if the link show be shown&lt;br /&gt;
		return &amp;#039;[[&amp;#039; .. link .. &amp;#039;|&amp;#039; .. display .. &amp;#039;]]&amp;#039; -- Return the link&lt;br /&gt;
	else&lt;br /&gt;
		return display -- Fallback to returning the display text&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Gets the wikitext for a place&lt;br /&gt;
local function getPlace(place, args)&lt;br /&gt;
	local placeArticle = place .. &amp;#039;, Ontario&amp;#039;&lt;br /&gt;
	local titleObj = mw.title.new(placeArticle)&lt;br /&gt;
	&lt;br /&gt;
	if (titleObj and titleObj.exists) or yesno(args.showred) then&lt;br /&gt;
		return &amp;#039;[[&amp;#039; .. placeArticle .. &amp;#039;|&amp;#039; .. place .. &amp;#039;]]&amp;#039;&lt;br /&gt;
	else&lt;br /&gt;
		return place&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Entry function&lt;br /&gt;
function p.jcon(frame)&lt;br /&gt;
	local args = getArgs(frame)&lt;br /&gt;
&lt;br /&gt;
	local roadType = (args[1] or &amp;#039;&amp;#039;):lower() -- Get the route type (region)&lt;br /&gt;
	local route = args[2] or &amp;#039;&amp;#039; -- Get the route number&lt;br /&gt;
&lt;br /&gt;
	local placeTypes = { -- Place types to remove from lowercase road type&lt;br /&gt;
		&amp;#039;municipality&amp;#039;,&lt;br /&gt;
		&amp;#039;municipal&amp;#039;,&lt;br /&gt;
		&amp;#039;city&amp;#039;,&lt;br /&gt;
		&amp;#039;township&amp;#039;,&lt;br /&gt;
		&amp;#039;district&amp;#039;,&lt;br /&gt;
		&amp;#039;county&amp;#039;,&lt;br /&gt;
		&amp;#039;counties&amp;#039;,&lt;br /&gt;
		&amp;#039;united counties&amp;#039;,&lt;br /&gt;
		&amp;#039;region&amp;#039;,&lt;br /&gt;
		&amp;#039;regional&amp;#039;,&lt;br /&gt;
		&amp;#039;regional municipality&amp;#039;,&lt;br /&gt;
		&amp;#039;road&amp;#039;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	for index, placeType in ipairs(placeTypes) do&lt;br /&gt;
		roadType = roadType -- Remove the place types from the road type&lt;br /&gt;
			:gsub(&amp;#039;^&amp;#039; .. placeType .. &amp;#039; of &amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
			:gsub(&amp;#039; &amp;#039; .. placeType .. &amp;#039;$&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
			:gsub(&amp;#039; &amp;#039; .. placeType .. &amp;#039; road$&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	roadType = data.aliases[roadType] or roadType -- Transform alias into proper name&lt;br /&gt;
&lt;br /&gt;
	if data.signs[roadType] or data.signs[route:lower()] then&lt;br /&gt;
		return data.signs[roadType] or data.signs[route:lower()] -- Return signs symbols like airport and hospital&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local roadInfo = data.types[roadType] -- Get road type info from the data module&lt;br /&gt;
&lt;br /&gt;
	if not roadInfo or not route then&lt;br /&gt;
		return &amp;#039;&amp;amp;#8203;&amp;#039; -- Return ZWSP if road type is not supported or the route is not specified&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local output = &amp;#039;&amp;#039;&lt;br /&gt;
	local shield = &amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
	if yesno(args.ot) then -- Set correct arguments if output should be only text&lt;br /&gt;
		args.nosh = &amp;#039;yes&amp;#039;&lt;br /&gt;
		args.nolink = &amp;#039;yes&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Define the shield&lt;br /&gt;
	if not yesno(args.nosh) then -- If allowed to add shield&lt;br /&gt;
		shield = shieldWikitext(route, roadInfo, args) -- Return the shield of the main road&lt;br /&gt;
	&lt;br /&gt;
		if args.con then&lt;br /&gt;
			if shield ~= &amp;#039;&amp;#039; then shield = shield .. &amp;#039;&amp;amp;nbsp;&amp;#039; end -- Add a NBSP if there&amp;#039;s already a shield&lt;br /&gt;
			shield = shield .. shieldWikitext(args.con, roadInfo, args) -- Add the shield for the first concurrency&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if args.con2 then&lt;br /&gt;
			if shield ~= &amp;#039;&amp;#039; then shield = shield .. &amp;#039;&amp;amp;nbsp;&amp;#039; end -- Add a NBSP if there&amp;#039;s already a shield&lt;br /&gt;
			shield = shield .. shieldWikitext(args.con2, roadInfo, args) -- Add the shield for the second concurrency&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if yesno(args.tch) then&lt;br /&gt;
			if shield ~= &amp;#039;&amp;#039; then shield = shield .. &amp;#039;&amp;amp;nbsp;&amp;#039; end -- Add a NBSP if there&amp;#039;s already a shield&lt;br /&gt;
			shield = shield .. &amp;#039;[[File:TCH-blank.svg|x20px]]&amp;#039; -- Add the TCH shield&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if not yesno(args[&amp;#039;pic aft&amp;#039;]) then&lt;br /&gt;
		output = shield -- Add the shield if it goes first&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Define the text&lt;br /&gt;
	if not yesno(args.notext) then -- If allowed to show text&lt;br /&gt;
		if output ~= &amp;#039;&amp;#039; then output = output .. &amp;#039;&amp;amp;nbsp;&amp;#039; end -- Add a NBSP after the shield if it exists&lt;br /&gt;
		output = output .. getText(route, roadInfo, args) -- Add text of the main route&lt;br /&gt;
	&lt;br /&gt;
		if args.con then&lt;br /&gt;
			output = output .. &amp;#039;&amp;amp;nbsp;/ &amp;#039; .. getText(args.con, roadInfo, args) -- Add text of the first concurrency&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
		if args.con2 then&lt;br /&gt;
			output = output .. &amp;#039;&amp;amp;nbsp;/ &amp;#039; .. getText(args.con2, roadInfo, args) -- Add text of the second concurrency&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
		if yesno(args.tch) then&lt;br /&gt;
			output = output .. &amp;#039;&amp;amp;nbsp;/ [[Trans-Canada Highway|TCH]]&amp;#039; -- Add the TCH text&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if args.dir then&lt;br /&gt;
		output = output .. &amp;#039; &amp;#039; .. args.dir -- Add main route direction&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if args.condir then&lt;br /&gt;
		output = output .. &amp;#039;/&amp;#039; .. args.condir -- Add first concurrency direction&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if args.condir2 then&lt;br /&gt;
		output = output .. &amp;#039;/&amp;#039; .. args.condir2 -- Add second concurrency direction&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if args[3] then&lt;br /&gt;
		output = output .. &amp;#039; (&amp;#039; .. args[3] .. &amp;#039;)&amp;#039; -- Add the name to the output&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if args.city or args.town then&lt;br /&gt;
		output = output .. &amp;#039; – &amp;#039; .. getPlace(args.city or args.town, args) -- Add the first city&lt;br /&gt;
	&lt;br /&gt;
		if args.city2 or args.town2 then&lt;br /&gt;
			output = output .. &amp;#039;, &amp;#039; .. getPlace(args.city2 or args.town2, args) -- Add the second city&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if yesno(args[&amp;#039;pic aft&amp;#039;]) and shield then&lt;br /&gt;
		if output ~= &amp;#039;&amp;#039; then output = output .. &amp;#039; &amp;#039; end -- Add a space if output already has text&lt;br /&gt;
		output = output .. shield -- Add the shield if it goes last&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return output&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Generates a list of supported regions&lt;br /&gt;
function p.supported(frame)&lt;br /&gt;
	local reverseAliases = {}&lt;br /&gt;
	local entries = {}&lt;br /&gt;
	local list = mw.html.create(&amp;#039;ul&amp;#039;) -- Create output list element&lt;br /&gt;
&lt;br /&gt;
	for alias, name in pairs(data.aliases) do -- Reverse the alias table to allow lookup by name&lt;br /&gt;
		if not reverseAliases[name] then&lt;br /&gt;
			reverseAliases[name] = {}&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		table.insert(reverseAliases[name], alias)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	for name, info in pairs(data.types) do -- Create tables for each region&lt;br /&gt;
		if reverseAliases[name] then&lt;br /&gt;
			for _, alias in ipairs(reverseAliases[name]) do&lt;br /&gt;
				name = name .. &amp;#039; / &amp;#039; .. alias -- Add alias to list item&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		list:tag(&amp;#039;li&amp;#039;):wikitext(name, &amp;#039; &amp;#039;, &amp;#039;(&amp;#039; .. info.prefix .. &amp;#039; &amp;#039; .. info.type .. &amp;#039;)&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
		&lt;br /&gt;
	for sign, wikitext in pairs(data.signs) do&lt;br /&gt;
		if reverseAliases[sign] then&lt;br /&gt;
			for _, alias in ipairs(reverseAliases[sign]) do&lt;br /&gt;
				sign = sign .. &amp;#039; / &amp;#039; .. alias -- Add alias to list item&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		list:tag(&amp;#039;li&amp;#039;):wikitext(sign, &amp;#039; &amp;#039;, wikitext)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return tostring(list)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Tachyony</name></author>
	</entry>
</feed>