Module:Sandbox/BrandonXLF/3: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 12:
-- Override the default format with exceptions for some highways
if division == 'highway' then
highwayNumber = tonumber(string.gsub(route, '%D', ''))
highwayNumber = tonumber(highwayNumber)
if route:upper() == '407ETR' then -- Picture exceptions
Line 29 ⟶ 30:
end
 
if frame:callParserFunction('#ifexist', 'FileMedia:' .. fileName, '1') ~= '' then -- Check if the file exists
local size = 'x20px' -- Default size
Line 45 ⟶ 46:
end
return '[[File:' .. exportfileName .. '|alt=|link=|' .. size .. ']]' -- Return the file wikitext
end
end
 
returnif frame:callParserFunction('#ifexist', '[[FileMedia:RR ' .. route .. ' jct.svg|alt', '1') ~=|link=|x20px]] '' then -- DefaultCheck if default image formatexists
return '[[File:RR ' .. route .. ' jct.svg|alt=|link=|x20px]]' -- Display default image format
end
return '' -- Fallback to returning nothing
end
 
Line 133 ⟶ 138:
if args['con'] then
if picture ~= '' then picture = picture .. ' ' end -- Add a NBSP if there's already a picture
picture = picture .. pictureWikitext(frame, args['con'], roadType, roadInfo, args) -- Add the picture of the first concurrency
end
 
if args['con2'] then
if picture ~= '' then picture = picture .. ' ' end -- Add a NBSP if there's already a picture
picture = picture .. pictureWikitext(frame, args['con2'], roadType, roadInfo, args) -- Add the picture of the second concurrency
end
 
if args['tch'] then
if picture ~= '' then picture = picture .. ' [[File:TCH-blank.svg|x20px]]' end -- Add thea NBSP if there's already TCHa picture
picture = picture .. '[[File:TCH-blank.svg|x20px]]' -- Add the TCH picture
end
end
if not args['pic aft'] and picture then
export = picture -- Add the picture if it goes first
end
Line 151 ⟶ 159:
-- Define the text
if not args['notext'] then -- If allowed to show text
if export ~= '' then export = export .. ' ' end -- Add a NBSP after the picture if it exists
if export then
export = export .. ' ' -- Add a NBSP after the picture if it exists
end
export = export .. getText(frame, route, roadInfo, args) -- Return text of road 1
if args['con'] then
export = export .. ' / ' .. getText(framframe, args['con'], roadInfo, args) -- Add the text of the first concurrency
end
Line 201 ⟶ 206:
cities = table.concat(cities, ', ') -- Concat the cities into a single string
if cities ~= '' then
export = export .. ' – ' .. cities -- Add the cities to the output
end
 
if args['pic aft'] and picture then
if export ~= '' then export = export .. ' ' end -- Add a space if export already has text
if export then
export = export .. ' ' -- Add a space if export already has text
end
export = export .. picture -- Add the picture if it goes last
end