跳转到内容

模板:Add file caption/doc

来自天灾之下:危险连接资料站
Hyucen​(留言 | 贡献)2025年12月16日 (二) 16:39的版本 (导入1个版本)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

This template inserts a tool for adding structured file captions to files in Wikimedia Commons.

This tool only edits Wikimedia Commons, but can be used from any wiki. See the installation instructions to get it working in your wiki.

Usage

{{Add file caption|History of Uruguay}}
Loading...

Installation

To install this template in your wiki:

  1. Create a template with the following markup. You can choose the template name, parameter names and defaults to suit your wiki.
    <includeonly><div class="AddFileCaption" data-category="{{{category|{{{1|}}}}}}" data-group="{{{group|}}}">Loading...</div>[[Category:Gadget:AddFileCaption]]</includeonly>
    
  2. Create MediaWiki:Gadget-AddFileCaption.js with the following code:
    /**
     * AddFileCaption is a tool for adding stuctured file captions to files in Wikimedia Commons
     * Documentation: https://www.mediawiki.org/wiki/AddFileCaption
     * Source code: https://www.mediawiki.org/wiki/MediaWiki:Gadget-Global-AddFileCaption.js
     */
    mw.loader.load( '//www.mediawiki.org/w/load.php?modules=ext.gadget.Global-AddFileCaption' );
    
  3. Add the following gadget to MediaWiki:Gadgets-definition:
    * AddFileCaption[ResourceLoader|hidden|default|categories=Gadget:AddFileCaption]|AddFileCaption.js
    

Done! Add your template to any page to verify that the installation was successful.

Localization

To help localize the messages of the interface, edit Data:AddFileCaption.tab.

Template data

This template inserts a tool for adding structured file captions to files in Wikimedia Commons.

模板参数

此模板首选参数换行的代码块格式。

参数描述类型状态
Categorycategory 1

Category page (with no prefix) on Wikimedia Commons where to get the files

示例值
History of Uruguay
页面名称必需
Groupgroup

User group to which to limit the use of the tool

示例值
autoconfirmed
字符串可选

See also