Citoid

cite-from-id is a node.js service which converts unique identifiers, such as a URL, to citations for use by RefToolbar and VisualEditor.

Installation
In order to have cite-from-id functioning on your wiki in conjunction with VisualEditor, you'll need the following: a working installation of VisualEditor and Parsoid, citation templates and a special json hook in order to hook VisualEditor and the templates together, and a working installation of Zotero's translation server.

At minimum, it is recommend you have the following extensions in your extension folder: Extension:VisualEditor, Extension:Scribunto, Extension:Cite, Extension:TemplateData. Extension:ParserFunctions is also recommended.

For developers, at the time being cite-from-id is not supported by the vagrant development environment.

VisualEditor and Parsoid

 * 1) Set up MediaWiki: Manual:Installation_guide
 * 2) Set up Parsoid: Parsoid/Setup
 * 3) Set up VisualEditor: Extension:VisualEditor

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)

Register your templates
You'll need to create a special message on your wiki: MediaWiki:Visualeditor-cite-tool-definition.json in order to enable citations. You can see an example definition on English Wikipedia. For more, see: VisualEditor/Citation_tool

You'll need Extension:TemplateData for the citation tool to be able to load the template data into the fields in VisualEditor. If you navigate to Special:Version and TemplateData is showing up but fields aren't present in the citation dialog, you may need to open the citation template for editing, make no changes, and save it again. This will flush the cache.

For more information on how to define template data for citations, and to see screenshots of how a citation window would look with and without template data defined, see: Wikipedia:VisualEditor/TemplateData

Zotero's translation server
See: Translation-server installation instructions

Implementation
The cite-from-id module will be a node.js service. A rough description of how the service would work is as follows:


 * 1) [client js] VisualEditor makes query for reference
 * 2) [node js] cite-from-id considers cache and either responds with the previously stored result or…
 * 3) [third party] Query against DOI/ISBN/ISSN/URL sources and return citation.

Design
ID handlers:


 * ISBN/ISSN: - > WorldCat Search API
 * DOI: -> Send accept header to CrossRef.
 * If 204, resolve URL and send to Zotero.
 * If 404 or 406, fail.
 * URL: -> If DOI, send to DOI: handler. Else, send to Zotero.

There are two ways to get citations, DOI via cross ref and Zotero; which is better? Should URLs with DOI ids be sent to cross ref, or DOIs be resolved into URLs and sent to Zotero?

Related extensions and services

 * Zotero translation server -- xpcshell-based Zotero translation server, and https://github.com/zotero/zotero-node, an abandoned and old nodejs equivalent
 * Zotero field mappings, including vs. some cite templates
 * Wikipedia citation templates
 * VisualEditor/Citation_tool
 * Sample cite-tool definition on Wikipedia Beta
 * Restface (node.js restful api)