Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Documentation for this module may be created at Module:BusStop/doc

local getArgs  = require( 'Module:Arguments' ).getArgs
local infobox = require( 'Module:InfoboxNeue' ):new()
local getStatus = require("Module:Status").get
local SMWUtil = require("Module:SMWUtil")
local createSubobject = SMWUtil.createSubobject

local p = {}

function p.infobox(frame)
    local args = getArgs(frame)

    --Main arguments
    local imgPath = args.image
    local title = args.title or mw.title.getCurrentTitle().text
    local captionTitle = args.caption_title
    local caption = args.caption
    local status = args.status
    local statusDescription = args.status_description

    local operator = args.operators
    local route = args.routes
    local closestStation = args.closest_station
    local closestTown = args.closest_town
    
    -- meta properties
    local use_subobject = args.use_subobject
    local smwIdentifier = frame:preprocess("{{FULLPAGENAME}}")

    if use_subobject == "true" then
        smwIdentifier = smwIdentifier .. "#" .. title
        createSubobject(frame, title, {
        	"Title=" .. (title or ""),
            "Image=" .. (imgPath or ""),
            "Operators=" .. (operator or ""),
            "Routes=" .. (route or usage or ""),
            "Closest Station=" .. (closestStation or ""),
            "Closest Town=" .. (closestTown or ""),
            "Status=" .. (status or ""),
            "Status Description=" .. (statusDescription or "")
        })
    end

	infobox:renderImageOrGallery(imgPath)

    if status then
        local text, class = getStatus(status)
        infobox:renderIndicator( {
            data = text,
            desc = statusDescription,
            class = class
        } )
    else
    	-- render the caption indicator only if there was no status provided
    	infobox:renderIndicator( {
        	data = captionTitle,
        	desc = caption,
    	} )
	end

	infobox:renderHeader( {
		title = title,
		subtitle = 'Bus Stop'
	} )

    local labels = {
        infobox:renderItem( {
            label = 'Operator',
            data = operator
        } ),
        infobox:renderItem( {
            label = 'Routes',
            data = operator
        } )
    }
    
    local info = {
        infobox:renderItem( {
            label = 'Closest Town',
            data = closestTown
        } ),
        infobox:renderItem( {
            label = 'Closest Station',
            data = closestStation
        } ),
    }
    infobox:renderSection( {
        content = table.concat(info),
        col = 2
    } )
    
    infobox:renderSection( {
    	title = "Information",
        content = table.concat(labels),
        col = 2
    } )
	return infobox:renderInfobox(args)
end


return p
🍪 Yum Yum Yum! Cookies help us better deliver our services. By using our site, you agree to our use of cookies.