|  Release status: stable | |
|---|---|
| Description | Provides basic Infobox functionality for Scribunto. | 
| Author(s) | Marius Hoch (Hoo mantalk) | 
| Compatibility policy | Snapshots releases along with MediaWiki. Master is not backward compatible. | 
| MediaWiki | 1.25+ | 
| Database changes | No | 
| License | GNU General Public License 2.0 or later | 
| Download | Download extension  Git [?]: | 
| Hooks used 
 | |
| Quarterly downloads | 68 (Ranked 107th) | 
| Translate the Capiunto extension if it is available at translatewiki.net | |
| Issues | Open tasks · Report a bug | 
The Capiunto (Latin: "they shall contain") extension provides a basic Infobox functionality for Scribunto.
An overview of the Lua methods which Capiunto provides can be found at /Infobox.
Capiunto provides flexible Infobox functionality for Scribunto and generates HTML for Infobox features such as headers and rows.
Capiunto is designed for clean and modern Infoboxes. Using Lua as a scripting language for Infobox templates, it was developed to make Infoboxes:
- clean and clutter-free
- usable across different language versions
- driven by data from Wikidata
- easy to maintain and extend
With Capiunto Lua code to create a basic Infobox might look like this:
local capiunto = require 'capiunto'
capiunto.create( {
	title = 'Title of the Infobox'
} )
:addRow( 'A label', 'some data' )
:addHeader( 'A header between the data rows' )
:addRow( 'Another label', 'more data' )
Requirements
Capiunto depends on the Scribunto extension.
Installation
- Download and place the file(s) in a directory called Capiuntoin yourextensions/folder.
- Add the following code at the bottom of your LocalSettings.php file: wfLoadExtension( 'Capiunto' ); 
 Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed. Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Example usage
| Module (Module:CapiuntoTest) | Template (Template:CapiuntoTest) | Article | 
|---|---|---|
| local capiunto = require 'capiunto'
local p = {}
function p.main(frame)
	local args = frame:getParent().args
	local headerStyle
	if args.headerstyle and args.headerstyle ~= '' then
		headerStyle = string.format('background-color:%s;', args.headerstyle)
	else
		headerStyle = 'background-color:grey;'
	end
	local retval = capiunto.create( {
		title = args.title,
		headerStyle = headerStyle, 
	} )
	:addImage( args.image, args.caption )
	:addRow( 'Foo', args.foo )
	:addHeader( 'A header between the data rows' )
	:addRow( 'Bar', args.bar )
	return retval
end
return p
 | <includeonly>{{#invoke:CapiuntoTest|main}}</includeonly> | {{CapiuntoTest
| title       = The title
| headerstyle = (defaults to background-color:grey)
| image       = [[File:Example.svg|200px]]
| caption     = An example image
| foo         = Something
| ("A header between the data rows")
| bar         = Something else
}} | 
See also
- Extension:Scribunto
- Extension:Scribunto/Lua reference manual
|  | This extension is being used on one or more Wikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia's CommonSettings.php and InitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki's Special:Version page. | 
|  | This extension is included in the following wiki farms/hosts and/or packages: This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. | 
    This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.