VisualEditor/Citation tool/zh

The VisualEditor citation tool allows users to use your wiki's citation templates from within VisualEditor. To enable the tool, you'll need the following: a working installation of VisualEditor and Parsoid, citation templates with TemplateData, and a special .json message in order to hook VisualEditor and the templates together.

It is recommended you have the following extensions for use with common citation templates: Extension:VisualEditor, Extension:Scribunto, Extension:Cite, Extension:TemplateData, and Extension:ParserFunctions.

Importing citation templates
You'll need citation templates in your wiki's database in order to use any citation features. If you do not currently have citation templates on your wiki (for example, in the case of a new installation) you'll need to get them. Copying them from Wikipedia is the easiest way to do this. If you already have citation templates on your wiki, you can skip these steps.


 * 1) Install Extension:Scribunto, Extension:Cite/Cite.php, Extension:ParserFunctions and Extension:TemplateData. Scribunto allows you to use the programming language lua in your citation templates, and most citation templates on Wikipedia are in lua and make use of the Parser Functions. The Cite extension allows you to use the tags. The TemplateData extension lets templates provide labelling and structured information about themselves for VisualEditor.
 * 2) Export citation templates from wikipedia: Manual:Using_content_from_Wikipedia. Exporting Template:Cite_web, Template:Cite_news, Template:Cite_journal, Template:Cite_book is a good place to start.
 * 3) Upload your templates using the Special:Import page on your wiki (for example, http://localhost/index.php/Special:Import)

Template Data
You'll need Extension:TemplateData for the citation tool to be able to load the template data into the fields in VisualEditor and each template must have template data defined. For more information on how to define template data for citations, and to see screenshots of how a citation window should look with and without template data defined, see: Wikipedia:VisualEditor/TemplateData

Citation Tool Definition
要在您的 wiki 中启用可视化编辑器引用工具，您需要创建特定的消息：. 因为每个 wiki 是不同的，所以需要定制它需要的那些功能，例如您 wiki 中的目标名可能与其他 wiki 中的不同.

配置消息的用途

消息

Once the  configuration message is created, the citation tool will be live for all VisualEditor users on your wiki within a few minutes.
 * 说明您 wiki 的标准引用中使用那种模板（可以多达 5 个）.
 * Note that each template must have TemplateData defined or the system will be very difficult for users to understand. If your wiki does not currently use citation templates, it is common to copy the templates from the English Wikipedia as a good general set.
 * 说明您希望在每种引用类型中使用的标签.
 * 标准的有四种：“web”、“book”、“news”和“journal”，它们与  一致等.
 * 说明您希望在每种引用类型中使用的图标.
 * There are a standard four, "ref-cite-web", "ref-cite-book", "ref-cite-news" and "ref-cite-journal", which correspond to CSS classes with the icon as a background SVG image called  etc.

更多类型

If you are considering adding an additional type, the development team would really like to talk with you first, to give advice, help create an appropriate icon, and so we can consider whether other wikis might also want this type defined for all wikis.

要添加其他类型，必须：


 * 1) 确定您要创建的类型
 * 2) * 在本例中您要使用数据库引用，所以必须调用“database”类型.
 * 3) 创建相应标签
 * 4) * For the example, you could make the label name "db" and add a label at   with the value "database". This should be in your wiki's content language. If your wiki uses multiple languages or scripts, you may need to create several of these labels.
 * 5) 创建一个图标
 * 6) * For the example, you could make the icon label "ref-cite-dbase", and create the icon as an SVG file uploaded to commons, create the icon class " " in  and add the icon you want with " " or similar.

例子

You can see example definition messages on the English Wikipedia and the Polish Wikipedia.

Troubleshooting
If you navigate to Special:Version and TemplateData is installed, but fields aren't showing up in the citation dialog, you may need to open the citation template for editing, make no changes, and save it again. This is due to a bug where TemplateData which is transcluded (i.e. present in Template:Cite_web/doc instead of directly on Template:Cite_web) is not loaded into the database until the parent template is edited; see.

Please note that the user experience will differ slightly when using your own templates other than the standard 4. For instance, a list of fields won't show up initially in the citation dialog, but you will be able to request a list of all possible fields by clicking a button.