317
редагувань
(Створена сторінка: require( 'strict' ) local Village = {} local metatable = {} local methodtable = {} metatable.__index = methodtable local common = require( 'Module:Common' ) local hatnote = require( 'Module:Hatnote' )._hatnote --- Create the infobox function methodtable.getInfobox( self ) local infobox = require( 'Module:InfoboxNeue' ):new( { placeholderImage = config.placeholder_image } ) local tabber = require( 'Module:Tabber' ).renderTabber sectionTabl...) |
Немає опису редагування |
||
| Рядок 54: | Рядок 54: | ||
infobox:renderSection( { | infobox:renderSection( { | ||
title = frame.args["назывка"], | title = frame.args["назывка"], | ||
subtitle = frame.args[" | subtitle = frame.args["пуднаголовок"], | ||
content = table.concat( sectionTable ) | content = table.concat( sectionTable ) | ||
} ) | } ) | ||
end | |||
--- Set the frame and load args | |||
--- @param frame table | |||
function methodtable.setFrame( self, frame ) | |||
self.currentFrame = frame | |||
self.frameArgs = require( 'Module:Arguments' ).getArgs( frame ) | |||
end | |||
--- New Instance | |||
function Village.new( self ) | |||
local instance = { | |||
categories = {} | |||
} | |||
setmetatable( instance, metatable ) | |||
return instance | |||
end | |||
--- Generates an infobox based on passed frame args and SMW data | |||
--- | |||
--- @param frame table Invocation frame | |||
--- @return string | |||
function Village.infobox( frame ) | |||
local instance = Village:new() | |||
instance:setFrame( frame ) | |||
local debugOutput = '' | |||
if instance.frameArgs[ 'debug' ] ~= nil then | |||
debugOutput = instance:makeDebugOutput() | |||
end | |||
return tostring( instance:getInfobox() ) .. debugOutput | |||
end | |||
--- "Main" entry point for templates that saves the API Data and outputs the infobox | |||
--- | |||
--- @param frame table Invocation frame | |||
--- @return string | |||
function Village.main( frame ) | |||
local instance = Village:new() | |||
instance:setFrame( frame ) | |||
instance:saveApiData() | |||
local debugOutput = '' | |||
if instance.frameArgs[ 'debug' ] ~= nil then | |||
debugOutput = instance:makeDebugOutput() | |||
end | |||
local infobox = tostring( instance:getInfobox() ) | |||
return infobox .. debugOutput .. table.concat( instance.categories ) | |||
end | end | ||