Module:Sandbox/BrandonXLF/3: Difference between revisions

Content deleted Content added
Restored revision 1042505863 by BrandonXLF (Restorer)
Tags: Undo Reverted
Undid revision 1042506830 by BrandonXLF (talk)
Line 3:
local p = {}
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local data = mw.loadData('Module:Sandbox/BrandonXLF/4')
 
Line 21 ⟶ 22:
elseif routeNum and routeNum >= 500 then -- Exception for secondary and tertiary highways
fileName = 'Ontario Highway ' .. route .. '.svg'
elseif yesno(args['shield'] == 'yes') then
fileName = 'Ontario ' .. route .. '.svg'
end
Line 36 ⟶ 37:
elseif routeNum and routeNum >= 800 and division == 'highway' then
size = '20px'
elseif yesno(args['shield'] == 'yes') and division == 'highway' then
size = 'x25px'
elseif division == 'toll' then
Line 75 ⟶ 76:
end
if (frame:callParserFunction('#ifexist', mw.title.new(link, '1') ~= ''.exists or yesno(args['showred'])) and not yesno(args['nolink'])) then -- Check if the link show be shown
return '[[' .. link .. '|' .. display .. ']]' -- Return the link
else
Line 84 ⟶ 85:
-- Gets the wikitext for a place
local function getPlace(frame, place, args)
if frame:callParserFunctionmw.title.new('#ifexist', place .. ', Ontario', '1') ~= ''.exists or yesno(args['showred']) then
return '[[' .. place .. ', Ontario|' .. place .. ']]'
else
Line 130 ⟶ 131:
local picture = ''
 
if yesno(args['ot']) then -- Set correct arguments if output should be only text
args['nosh'] = 'yes'
args['nolink'] = 'yes'
Line 136 ⟶ 137:
 
-- Define the picture
if not yesno(args['nosh']) then -- If allowed to add shield
picture = pictureWikitext(frame, route, roadType, roadInfo, args) -- Return picture of road 1
Line 149 ⟶ 150:
end
 
if yesno(args['tch']) then
if picture ~= '' then picture = picture .. ' ' end -- Add a NBSP if there's already a picture
picture = picture .. '[[File:TCH-blank.svg|x20px]]' -- Add the TCH picture
Line 155 ⟶ 156:
end
if not yesno(args['pic aft']) then
export = picture -- Add the picture if it goes first
end
 
-- Define the text
if not yesno(args['notext']) then -- If allowed to show text
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
Line 172 ⟶ 173:
end
if yesno(args['tch']) then
export = export .. ' / [[Trans-Canada Highway|TCH]]' -- Add the TCH text
end
Line 216 ⟶ 217:
end
 
if yesno(args['pic aft']) and picture then
if export ~= '' then export = export .. ' ' end -- Add a space if export already has text
export = export .. picture -- Add the picture if it goes last