Module:Sandbox/BrandonXLF/4: Difference between revisions

Content deleted Content added
Fix
Fix errors
 
(24 intermediate revisions by the same user not shown)
Line 1:
-- Sandbox, do not delete
local config = require('Module:Authority control/config').config
local ac = require('Module:Authority control')
local p = {}
 
local roadDataModule = require('Module:Road data/sandbox') -- REMOVE SANDBOX
function p.main(frame)
 
local args = { state = frame.args.state }
function p._shieldmain(args)
local shields = {}
local routeCount = 1
while args[routeCount * 2 - 1] do
for _, conf in pairs(config) do
local route = {
args[conf[1]] = mw.wikibase.getBestStatements('P'..conf.property, 'P1855')[1].qualifiers['P' .. conf.property][1].datavalue.value
country = args['country' .. routeCount] or args.country,
state = args['state' .. routeCount] or args['province' .. routeCount] or args.state or args.province,
type = args[routeCount * 2 - 1],
route = args[routeCount * 2]
}
if not route.country then
local countryModule = mw.loadData('Module:Road data/countrymask')
route.country = countryModule[route.state] or 'UNK'
end
 
local shield = roadDataModule.shield(route, 'main', 'infobox', true)
table.insert(shields, shield)
 
routeCount = routeCount + 1
end
 
return table.concat(shields, ' ')
local newParentFrame = frame:newChild{ title = 'Foo', args = args }
end
local newFrame = newParentFrame:newChild{ title = 'Template:Authority control', args = {} }
 
function p.mainshieldmain(frame)
return require('Module:Suppress categories').main( ac.authorityControl( newFrame ) )
local acargs = require('Module:Authority controlArguments').getArgs(frame)
return p._shieldmain(args)
end