This documentation is transcluded from Module:Navplate/Manufacturers/doc. Changes can be proposed in the talk page.
Module:Navplate/Manufacturers is shared across the Star Citizen Wikis.
This module is shared across the Star Citizen Wikis. Any changes should also be relayed to the GitHub repository.
This module is unused.
This module is neither invoked by a template nor required/loaded by another module. If this is in error, make sure to add
{{Documentation}}
/{{No documentation}}
to the calling template's or parent's module documentation.Function list |
---|
local NavplateManufacturers = {}
local metatable = {}
local methodtable = {}
metatable.__index = methodtable
local navplate = require( 'Module:Navplate' )
local template = mw.loadJsonData( 'Module:Navplate/Manufacturers/data.json' );
--- Queries the SMW Store
--- @return table
--- TODO: Need a lot of clean up to make this generic
function methodtable.getSmwData( self, category )
local askData = {
'[[:+]]',
'[[' .. self.category .. ']]',
'?#-=page',
'?Category#'
}
local data = mw.smw.ask( askData )
--mw.logObject( data )
local newData = {}
for _, navplateRow in ipairs( template[ 'content' ] ) do
local label = navplateRow[ 'label' ]
for _, result in pairs( data ) do
if result[ 'Category' ] ~= nil and type( result[ 'Category' ] ) == 'table' then
for _, category in pairs( result[ 'Category' ] ) do
if category == navplateRow[ 'conditions' ] then
if newData[ label ] == nil then
newData[ label ] = {}
end
table.insert( newData[ label ], result.page )
end
end
end
end
end
mw.logObject( newData )
end
--- Outputs the table
---
--- @return string
function methodtable.make( self )
local args = {
subtitle = 'Products of',
title = 'Manufacturer'
}
local data = self:getSmwData( self.category )
-- mw.logObject( args )
return navplate.navplateTemplate({
args = args
})
end
--- New Instance
---
--- @return table NavplateManufacturers
function NavplateManufacturers.new( self, frameArgs )
local instance = {
category = 'Category:Greycat Industrial'
}
setmetatable( instance, metatable )
return instance
end
--- "Main" entry point
---
--- @param frame table Invocation frame
--- @return string
function NavplateManufacturers.main( frame )
local instance = NavplateManufacturers:new()
return instance:make()
end
return NavplateManufacturers