扩展:Capiunto
Jump to navigation
Jump to search
Capiunto 发布状态: 稳定版 |
|
---|---|
描述 | 为Scribunto提供基本信息框功能。 |
作者 | Marius Hoch (Hoo man讨论) |
兼容性方针 | 发行分支 |
MediaWiki | 1.25+ |
数据庫更改 | 否 |
许可协议 | GNU通用公眾授權條款2.0或更新版本 |
下载 | |
翻譯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页面找到。 |
Categories:
- Stable extensions/zh
- Extensions with invalid or missing type/zh
- GPL licensed extensions/zh
- Extensions in Wikimedia version control/zh
- ScribuntoExternalLibraries extensions/zh
- ScribuntoExternalLibraryPaths extensions/zh
- All extensions/zh
- Extensions used on Wikimedia/zh
- Scribunto extensions/zh
- Infobox extensions/zh