Module:Sandbox/BrandonXLF/3: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 10:
 
if roadInfo['pic'] then
local fileName = roadInfo['pic'][1] .. route .. roadInfo['pic'][2] -- Get filename from template
 
-- Override the default format with exceptions for some highways
if division == 'highway' or division == 'toll' then
highwayNumber = string.gsub(route, '%D', '')
highwayNumber = tonumber(highwayNumber)
Line 37:
end
if existingFile == '' and mw.title.new('File:RRdivision ~= 'highway' ..and routedivision ..~= ' jct.svgtoll').file.exists then -- Check if the fallback file exists and record ifshould itbe doesused
existingFilelocal fileName = 'File:RR ' .. route .. ' jct.svg' -- Get fallback file name
 
if mw.title.new('File:' .. fileName).file.exists then -- Check if the fallback file exists and recoed it if it does
existingFile = existingFile
end
end
 
Line 167 ⟶ 171:
if export ~= '' then export = export .. ' ' end -- Add a NBSP after the picture if it exists
export = export .. getText(frame, route, roadInfo, args) -- Return text of road 1
if args['dir'] then export = export .. ' ' .. args['dir'] end -- Add the dir
if args['con'] then
export = export .. ' / ' .. getText(frame, args['con'], roadInfo, args) -- Add the text of the first concurrency
if args['condir'] then export = export .. ' ' .. args['condir'] end -- Add the dir
end
if args['con2'] then
export = export .. ' / ' .. getText(frame, args['con2'], roadInfo, args) -- Add the text of the firstsecond concurrency
if args['condir2'] then export = export .. ' ' .. args['condir2'] end -- Add the dir
end
Line 182 ⟶ 183:
export = export .. ' / [[Trans-Canada Highway|TCH]]' -- Add the TCH text
end
end
local dirs = {} -- Table to store directions
if args['dir'] then
table.insert(cities, args['dir']) -- Add the primary direction
end
 
if args['condir'] then
table.insert(cities, args['condir']) -- Add the first concurrency direction
end
 
if args['condir2'] then
table.insert(cities, args['condir2']) -- Add the second concurrency direction
end
dirs = table.concat(dirs, '/') -- Concat the directions into a single string
if dirs ~= '' then
export = export .. ' – ' .. dirs -- Add the directions to the output
end
 
Line 191 ⟶ 211:
local cities = {} -- Table to store cities
 
local city =if args['city'] or args['town'] then
if table.insert(cities, getPlace(frame, args['city'] or args['town'], args)) then -- Add the first city
end -- Add the first city
table.insert(cities, getPlace(frame, city, args))
end
local city2 =if args['city2'] or args['town2'] then
if table.insert(cities, getPlace(frame, args['city2'] or args['town2'], thenargs)) -- Add the second city
end -- Add the second city
table.insert(cities, getPlace(frame, city2, args))
end
cities = table.concat(cities, ', ') -- Concat the cities into a single string