Module:PTV route
Appearance
This module implements {{PTV route}} and {{cite PTV route}}. Please see the template pages for documentation.
To update the bus route data, please see Module:PTV route/data.
-- This module implements [[Template:PTVBus]].
local data = mw.loadData('Module:PTVBus/data')
local p = {}
function p._main(args)
local route = args.route or '' -- Don't need to trim args.route as named args are trimmed automatically
if route == '' then
return nil
end
local routeData = data[route]
if not routeData then
return nil
end
local url = 'https://www.ptv.vic.gov.au/route/' .. routeData.page
local display
if args.numtext then
display = route
elseif args.deftext then
display = routeData.text
else
display = args.text
end
if display then
return string.format('[%s %s]', url, display)
else
return string.format('[%s]', url)
end
end
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:PTVBus',
})
return p._main(args)
end
return p