Content deleted Content added
BrandonXLF (talk | contribs) Stop using user sandbox |
BrandonXLF (talk | contribs) Update error message |
||
(One intermediate revision by the same user not shown) | |||
Line 2:
local p = {}
local
local getArgs = require('Module:Arguments').getArgs
-- Generate a link to a route
local function makeRoute(route, routeType, routeLoc, currProvince)
local out = ''
Line 41 ⟶ 43:
end
-- Generate the content for a
local function makeNav(prefix, label, currProvince, args)
function p.route(frame)▼
return makeRoute(▼
frame.args.type,▼
frame.args.province,▼
frame.args.curr_province or frame.args.province▼
)▼
end▼
local prefix = frame.args[1]▼
local index = 1▼
local out = ''
▲ local index = 1
while args[paramPrefix] and args[paramPrefix] ~= '' do
local
▲ local routeLoc = templateArgs[prefix .. index .. '_province']
if index ~= 1 then
Line 94 ⟶ 62:
index = index + 1
paramPrefix = prefix .. index
end
Line 103 ⟶ 72:
end
--
local function getName(type)
▲end
-- Generate highway rows (headers and content cells)
▲ local data = mw.loadData('Module:Interprovincial highway/data')
▲ return data.types[frame.args[1]] or require('Module:Error').error{'Unknown |type='}
local out = ''
args.curr_type,
▲ )
local index = 1
local paramPrefix = ''
repeat
out = out .. '|-\n'
out = out .. '! colspan=3 | ' .. getName(args[paramPrefix .. 'name']) .. '\n'
out = out .. '|- style="text-align: center;"' .. '\n'
out = out .. '| style="width: 30%;" | ' .. makeNav(paramPrefix .. 'prev', 'Previous', args.curr_province, args) .. '\n'
out = out .. '| style="width: 30%;" | ' .. current .. '\n'
out = out .. '| style="width: 30%;" | ' .. makeNav(paramPrefix .. 'next', 'Next', args.curr_province, args) .. '\n'
index = index + 1
paramPrefix = 'hwy' .. index .. '_'
until (not args[paramPrefix .. 'name']) or args[paramPrefix .. 'name'] == ''
return out
end
-- Show the supported types in a table
function p.supported(frame)
local data = mw.loadData('Module:Interprovincial highway/data')
|