Difference between revisions of "Module:Car infobox"
		
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
		
		
		
		
		
	
|  (Created page with "local capiunto = require 'capiunto'  local p = {}  function p.main(frame) 	local args = frame:getParent().args 	local retval = capiunto.create({ 		title = args.name, 		headerS...") | |||
| (15 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | local capiunto = require  | + | local capiunto = require("capiunto") | 
| local p = {} | local p = {} | ||
| Line 5: | Line 5: | ||
| function p.main(frame) | function p.main(frame) | ||
| 	local args = frame:getParent().args | 	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({ | 	local retval = capiunto.create({ | ||
| − | + | 		top = args.name or mw.title.getCurrentTitle().text, | |
| − | 		headerStyle =  | + | 		headerStyle = "background-color: blue; color: white;",   | 
| + | 		topStyle = "background-color: blue; color: white;" | ||
| 	}) | 	}) | ||
| − | 	if args.image and args.image ~=  | + | 	if args.image and args.image ~= "" then retval:addImage("[[File:"..args.image.."|225px]]" or "", args.caption or nil) end | 
| − | 	retval:addRow(  | + | 	retval:addRow("Manufacturer", "[[Has manufacturer::"..args.manufacturer.."]]") | 
| − | 	:addRow(  | + | 	:addRow("Year", "[[Has year::"..tonumber(args.year).."]]") | 
| − | 	--:addHeader(  | + | 	:addRow("Featured in", args.featured) | 
| − | 	:addRow(  | + | 	--:addHeader("A header between the data rows") | 
| + | 	:addRow("<abbr title=\"Brake horsepower\">BHP</abbr>", "[[Has horsepower::"..tonumber(args.bhp or 0).."]] BHP") | ||
| 	return retval | 	return retval | ||
| end | end | ||
| return p | return p | ||
Latest revision as of 20:39, 17 September 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", "[[Has manufacturer::"..args.manufacturer.."]]")
	:addRow("Year", "[[Has year::"..tonumber(args.year).."]]")
	:addRow("Featured in", args.featured)
	--:addHeader("A header between the data rows")
	:addRow("<abbr title=\"Brake horsepower\">BHP</abbr>", "[[Has horsepower::"..tonumber(args.bhp or 0).."]] BHP")
	return retval
end
return p
