扩展:Capiunto
![]() 發布狀態: 穩定版本 |
|
---|---|
描述 | 为Scribunto提供基本信息框功能。 |
作者 | Marius Hoch (Hoo man讨论) |
兼容性政策 | 快照跟随MediaWiki发布。 master分支不向後兼容。 |
MediaWiki | 1.25+ |
数据库更改 | 否 |
许可协议 | GNU通用公眾授權條款2.0或更新版本 |
下載 | |
Quarterly downloads | 68 (Ranked 107th) |
翻譯Capiunto扩展,若在translatewiki.net可用 | |
問題 | 尚未完成的工作 · 报告錯誤 |
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' )
条件
Capiunto依赖于Scribunto扩展。
安裝
- 下载文件,并将其放置在您
extensions/
文件夹中的Capiunto
目录内。 - 将下列代码放置在您的
LocalSettings.php
的底部:wfLoadExtension( 'Capiunto' );
- 完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。
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 }} |
参见
此扩展用于一个或多个维基媒体项目。 这可能意味着扩展足够稳定、运作足够良好,可以用在这样的高流量的网站上。 请在维基媒体的CommonSettings.php和InitialiseSettings.php配置文件中查找此扩展的名称以查看哪些网站安装了该扩展。 特定wiki上的已安装的扩展的完整列表位于Special:Version页面。 |
这个扩展包含在以下包和/或维基农场: 这不是一个权威的名单。一些维基农场/主机可能包含这个extension,即使它们没有在这里列出。经常检查您的维基农场/主机或包来确认。 |