Module:Sandbox/BrandonXLF/4: Difference between revisions

Content deleted Content added
Allow sandbox
Fix errors
 
(23 intermediate revisions by the same user not shown)
Line 1:
-- Sandbox, do not delete
local config = require('Module:Authority control/config').config
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 template = frame.args.sandbox and 'Template:Authority control/sandbox' or 'Template:Authority control'
local shields = {}
local routeCount = 1
while args[routeCount * 2 - 1] do
for _, conf in pairs(config) do
local route = {
local statement = mw.wikibase.getBestStatements('P'..conf.property, 'P1855')[1]
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 statementnot route.country then
local countryModule = mw.loadData('Module:Road data/countrymask')
args[conf[1]] = statement.qualifiers['P' .. conf.property][1].datavalue.value
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, args = {} }
 
function p.mainshieldmain(frame)
return require('Module:Suppress categories').main( ac.authorityControl( newFrame ) )
local args = require('Module:Arguments').getArgs(frame)
return p._shieldmain(args)
end