Module:Sandbox/BrandonXLF/3: Difference between revisions

Content deleted Content added
No edit summary
Tag: Reverted
Restored revision 1042505863 by BrandonXLF (Restorer)
Tags: Undo Reverted
Line 3:
local p = {}
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local data = mw.loadData('Module:Sandbox/BrandonXLF/4')
 
Line 22 ⟶ 21:
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 37 ⟶ 36:
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 76 ⟶ 75:
end
if (frame:callParserFunction(mw.title.new('#ifexist', 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 85 ⟶ 84:
-- Gets the wikitext for a place
local function getPlace(frame, place, args)
if mw.title.newframe:callParserFunction('#ifexist', place .. ', Ontario', '1').exists ~= '' or yesno(args['showred']) then
return '[[' .. place .. ', Ontario|' .. place .. ']]'
else
Line 131 ⟶ 130:
local picture = ''
 
if yesno(args['ot']) then -- Set correct arguments if output should be only text
args['nosh'] = 'yes'
args['nolink'] = 'yes'
Line 137 ⟶ 136:
 
-- 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 150 ⟶ 149:
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 156 ⟶ 155:
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 173 ⟶ 172:
end
if yesno(args['tch']) then
export = export .. ' / [[Trans-Canada Highway|TCH]]' -- Add the TCH text
end
Line 217 ⟶ 216:
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