Difference between revisions of "Module:Car infobox"

From Gran Turismo Knowledge Base
Jump to navigation Jump to search
(what)
(fixed it)
 
Line 7: Line 7:
 
if not args.manufacturer or not args.year or not args.featured then error("Incorrect parameters to the car infobox") end
 
if not args.manufacturer or not args.year or not args.featured then error("Incorrect parameters to the car infobox") end
 
local retval = capiunto.create({
 
local retval = capiunto.create({
top = args.name or "{{BASEPAGENAME}}",
+
top = args.name or mw.title.getCurrentTitle().text,
 
headerStyle = "background-color: blue; color: white;",  
 
headerStyle = "background-color: blue; color: white;",  
 
topStyle = "background-color: blue; color: white;"
 
topStyle = "background-color: blue; color: white;"

Latest revision as of 12:15, 29 August 2025

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

local capiunto = require("capiunto")

local p = {}

function p.main(frame)
	local args = frame:getParent().args
	if not args.manufacturer or not args.year or not args.featured then error("Incorrect parameters to the car infobox") end
	local retval = capiunto.create({
		top = args.name or mw.title.getCurrentTitle().text,
		headerStyle = "background-color: blue; color: white;", 
		topStyle = "background-color: blue; color: white;"
	})
	if args.image and args.image ~= "" then retval:addImage("[[File:"..args.image.."|225px]]" or "", args.caption or nil) end
	retval:addRow("Manufacturer", "[["..args.manufacturer.."]]")
	:addRow("Year", tonumber(args.year))
	:addRow("Featured in", args.featured)
	--:addHeader("A header between the data rows")
	:addRow("<abbr title=\"Brake horsepower\">BHP</abbr>", tonumber(args.bhp or 0).." BHP")
	return retval
end

return p