Citoid
Sabis na citoid Node.js yana haifar da bayanan da aka ba URL, DOI, ISBN, PMID, PMCID ko QID. Yana da tsawo na aboki, Citoid , wanda ke nufin samar da amfani da sabis na citoid zuwa VisualEditor , amma kuma ana iya samun dama daga palette na gyara wikicode, idan an kunna.
Citoid
![]()
|
![](http://upload.wikimedia.org/wikipedia/commons/thumb/d/d7/Citoid_results_in_VisualEditor_Screen_Shot_2015-04-02.png/360px-Citoid_results_in_VisualEditor_Screen_Shot_2015-04-02.png)
A halin yanzu ana tura shi cikin duk WMF-Wikis mai kunna VisualEditor [1], kodayake an saita tsawaita akan wasunsu.
Jama'a API
Don neman metadata game da URL, DOI, PMCID, PMID ko QID, zaku iya amfani da ƙarshen API na harshen Ingilishi. Gwada shi! Ko, don buƙatun harshe na gida, yi amfani da Wikipedia harshen da kuka fi so
Batun tracker da gudanar da ayyuka
Bugs, issues, and suggestions for improvement can be added to the Citoid Phabricator project. (Learn more about Phabricator.)
Shigowa
Citoid is a Node.js app that also requires a working installation of Zotero's translation server, which uses the Zotero translators library, and xulrunner.
Shigar nodejs da npm
Install nodejs and npm. When you are using Ubuntu and depending on OS version you will not end up with the most recent version of nodejs. You are recommended to use nvm[1] to manage nodejs installations.
sudo apt-get install nodejs npm
Don sauran tsarin, duba:
- https://nodejs.org/download/
- https://nodejs.org/en/download/package-manager/
- (Debian Squeeze, Wheezy) https://gist.github.com/x-Code-x/2562576
Shiga daga karce =
Shigar kuma saita sabar fassarar Zotero
For citoid versions 0.5.3 or earlier, see Translation-server installation instructions
For citoid versions 1.0.0 or higher:
- Clone the repository
git clone --recursive https://gerrit.wikimedia.org/r/mediawiki/services/zotero
- If you forget the recursive flag, do
git submodule init
then dogit submodule update
- Change into the directory
cd zotero
- Install the libraries
npm install
- Run the server:
npm start
- You should get the following output:
(3)(+0000000): Translators initialized with 528 loaded
(3)(+0000003): Listening on 0.0.0.0:1969
Try a query to verify it's working: curl -d 'https://www.ncbi.nlm.nih.gov/pubmed/?term=crispr' -H 'Content-Type: text/plain' http://127.0.0.1:1969/web
Shigar kuma saita sabis na citoid
Samu code
If you want to do an anonymous checkout:
git clone https://gerrit.wikimedia.org/r/mediawiki/services/citoid
Or if you plan to hack citoid, then please follow the Gerrit 'getting started' docs and use an authenticated checkout url instead, such as:
git clone ssh://<user>@gerrit.wikimedia.org:29418/mediawiki/services/citoid
JS dogara
Install the JS dependencies. Run this command in the citoid directory:
npm install
Gyara config.yaml
Config.yaml contains the configuration for the citoid service. The defaults should work out of the box for development, however, they may need to be modified in a deployment set-up.
Guda uwar garken fassarar =
You'll first need to run translation-server; see the directions on its github page, but generally from the translation-server directory you should run:
git submodule init
git submodule update
npm i
npm start
Run Citoid uwar garken =
You should be able to start the citoid web service from the citoid directory using:
node server.js
This will start the citoid service on port 1970. To test it, navigate to http://localhost:1970 in your browser. You'll be able to test sample queries from this page.
Shiga Citoid tsawo =
See Extension:Citoid for how to download and install the Citoid MediaWiki extension.
Sanya Citoid akan wiki mai kunna Citoid
The Citoid extension must be configured using special TemplateData maps and a special citoid-specific message. It is currently deployed in all VisualEditor-enabled WMF-Wikis, but it must be configured before it can be used.
Tabbatar cewa kowane samfuri za a yi amfani da shi a MediaWiki:Citoid-template-type-map.json yana da ƙimar taswirar 'citoid'
Since Citoid has its own set of fields for each document type (for instance, the journal name is called 'publicationTitle' in citoid, but 'journal' in Template:Cite_journal), each Template must have TemplateData defined that creates a map between citoid's fields and the Template's field. Calling the map 'citoid' lets the Citoid extension know which map to look for. If the map 'citoid' doesn't suit your purposes for use with say, a userscript, you may create a citoid service related map that is called something else; an unlimited number of maps with unique keys are allowed in the maps object. Note that you can only see TemplateData maps in edit mode; they are not visible in the TemplateData table.
Fields issn and isbn can have Arrays [] in the citoid map; using them ensures that only one ISBN is in the field. If you do not place the parameter inside an Array (i.e. isbn: "[ISBN]"), multiple ISBNs or ISSNS will be concatenated in the field (i.e. "issn: 1234-5678, 7777-7777'). All 'person' fields, e.g. author, editor, translator, contributor etc, support 2D Arrays [[]] in the citoid map for first name and last name. It also supports a 1D array for full name fields; this will concatenate the name with the first field first, separated by a space. See sample templateData below for examples.
Examples of map objects on English Wikipedia that are compatible with the Citoid extension are:
- https://en.wikipedia.org/wiki/Template:Citation/doc
- https://en.wikipedia.org/wiki/Template:Cite_journal/doc
- https://en.wikipedia.org/wiki/Template:Cite_web/doc
- https://en.wikipedia.org/wiki/Template:Cite_news/doc
- https://en.wikipedia.org/wiki/Template:Cite_book/TemplateData
Sanya sarari suna na MediaWiki na musamman Saƙon Citoid
You'll need to configure a special MediaWiki: namespace message. This message maps the native citoid types (website, book, journalArticle) to the appropriate template (Cite web, Cite book, Cite journal). You should match a template to every single citoid type; there is no default behaviour if no template is matched to a particular type. It's better to have a bad match (there may be some fields in common between video liner notes and a book, or video liner notes and a video, for example) than none at all.
You may consider using en wiki's Template:Citation as a catch-all for types where there is no good type match as it is designed for this situation.
An sample namespace message is found here: Citoid/MediaWiki:Citoid-template-type-map.json
Every available citoid type is listed as a key in the sample namespace message.
Shirya matsala Citoid VisualEditor Extension
Open your browser's console. The Citoid extension will log errors here.
Inspector baya bayyana a cikin kayan aiki =
An icon for the inspector should appear in the toolbar menu. This means either citoid is not installed properly or not configured properly. Verify the extension and dependent extensions are installed on the page localhost:/wiki/Special:Version.
If the extensions are installed and the icon does not appear in the toolbar, it most likely means there's a problem with MediaWiki:Citoid-template-type-map.json. If there is no message at that location, or if the JSON is invalid, the inspector will not load. Look at the messages logged to your browser's console to diagnose the specific problem with the message. Alternatively, you may need to refresh your JavaScript cache.
Sami "ba zai iya yi maka ambato ba" kowane lokaci
You may consistently get this error if the citation template being inserted contains no maps data, or if the maps data is there but not making it to the MediaWiki API.
First, determine the template that the inspector is attempted to insert, for example, Template:Cite web/doc
.
View source of the template or documentation page to verify that
"maps": { "citoid": {
is present and contains fields. Then verify that these data are making it to the MediaWiki API by visiting the API page, i.e. http://localhost/api.php?action=templatedata&titles=Template:Cite%20web/doc&format=jsonfm on your local installation, or https://en.wikipedia.org/w/api.php?action=templatedata&titles=Template:Cite%20web&format=jsonfm on en wiki.
If the maps object is present in TemplateData, but not in the API response, try editing the template where the TemplateData is transcluded i.e. Template:Cite_web
(but making no changes) and saving it, a.k.a. a "null edit".
There is a known bug with transcluded TemplateData where it can take a long time for the API to update (task T52372); null edits force the change.
If the response from the API looks okay, there may be an issue with installation of the citoid service. Open up your browser's debugger to confirm that the responses from the citoid server are OK.
= Har yanzu inspector yana "jiran" bayan wani dogon lokaci mai tsawo bayan shigar
This typically means there is a bug. If you open your JavaScript console, you will likely find error messages that will help you debug.
An tsara kwanan watan shiga daban akan wiki dina
The dates are in ISO format, which is an international standard. On the back-end, we're sticking to ISO and in the future all dates will all be in ISO, not just access date. This is because it is an unambiguous way to present the date in any language. If the community doesn't like the way this looks to the user, it is possible to edit the citation template to format the ISO dates to something that is standard in your language. For instance, you can add logic to the template such that if the date is detected to be in ISO yyyy/mm/dd format, the date is reformatted *to appear* to be dd/mm/yyyy on the page. However, if you do this, the underlying data (i.e. when you edit the wikitext, or the form in VisualEditor) will still remain the same.
Matsalar sabis na citoid
Ba a gane rukunin yanar gizon da na fi so ta citoid kuma kawai yana samun bayanan asali =
The Citoid service relies on the brilliant Zotero community for much of the "magic", as Zotero translators need to be written for each site. You can see a list of all Zotero translators at https://github.com/zotero/translators. Right now, Zotero best supports English-language sources. We need your help to improve coverage of other sites. You can write your own Zotero translator. Start by looking at Citoid/Creating Zotero translators.
Gwaji ga masu fassara ta amfani da zaɓin "server" ko 'v' flag
To test with translation-server, download and install https://github.com/zotero/translation-server Your translator will need to have the 'v' flag enabled for 'browserSupport'. More here on that: https://www.zotero.org/support/dev/translators As an example, see https://github.com/zotero/translators/blob/master/A%20Contra%20Corriente.js ; you will see there are a bunch of letters, one of which is v, which corresponds to translation-server. If server support is not enabled by testing it/then adding the 'v' flag, we won't be able to use the translator.
Hacking citoid
Shigarwa =
If you are using vagrant, you can enable the citoid role to hack on the citoid service.
If you plan to hack on the Citoid extension, you should enable the following roles:
visualeditor-wikimedia
templatestyles
After enabling the roles, you will further need to add wiki pages to get citoid working. The most expedient way to do this is to export the following pages from en-wiki:
Template:Citation
Template:Cite_web
Template:Cite_news
Template:Cite_journal
Template:Cite_book
MediaWiki:Citoid-template-type-map.json
MediaWiki:Cite-tool-definition.json
MediaWiki:Visualeditor-cite-tool-name-web
MediaWiki:Visualeditor-cite-tool-name-book
MediaWiki:Visualeditor-cite-tool-name-journal
MediaWiki:Visualeditor-cite-tool-name-news
And then import them: localhost:8080/wiki/Special:Import.
After importing the Templates, you may need to navigate to the template, hit the edit button, and then hit save (a "null" edit), in order for the templatedata to propagate to the DB.
Gwaje-gwaje masu gudana =
sabis na citoid
npm test
runs eslint and unit tests.
mocha
runs the full set of tests.
(You can run ./node_modules/mocha/bin/mocha
if you only have mocha installed locally)
npm run-script coverage
runs the tests and reports code coverage.
In order for all tests to pass, you will need a WorldCat wskey in your config.dev.yaml file, which you can request at here.
Another reason why some tests may fail erroneously is if your DNS will redirect invalid domains to a valid IP (Such as BT Internet's DNS); in some cases, this causes a 520 response instead of a 400 response to be returned. This can be fixed by configuring your internet connection to use OpenDNS or another DNS that does not do this.
Citoid tsawo
See: Manual:JavaScript unit testing
Ƙirƙirar fitowar citoid na Citoid
Citoid depends on Extension:TemplateData for mapping variables from a wiki's citation templates to citoid's fields.
However, it may not be apparent that the formatting output of citations from Citoid isn't managed explicitly by Citoid but rather by TemplateData.
As such, if a particular citation format is required, you'll need to adjust the "format" in your citation templates' TemplateData.
Guidance is provided in Help:TemplateData.
You may, for example, see "format": "inline"
at the bottom of many pre-existing TemplateData Citoid maps, which means the resulting citation output will appear inline.
However, this will not put any spacing in the resulting citation text.
If the output should have a space before each pipe character but no spaces before or after an equals sign in the citation, one may set "format": "{{_ |_=_}}"
.
The code would typically be placed before closing out with the final curly brace, as such:
<templatedata>
{
"description": "",
"params": {
"1": {
"label": "",
"description": "",
"type": ""
},
"2": {
"label": "",
"description": "",
"type": ""
}
},
"paramOrder": [
],
"maps": {
"citoid": {
}
},
"format": "{{_ |_=_}}"
}
</templatedata>
Consult Help:TemplateData for more formatting options.
It's worth noting that if you want to change this format on a large wiki project, you should probably discuss it somewhere with the community as users may have strong feelings about formatting in citations. Additionally, note that when "format" is changed on an existing wiki, it will cause VisualEditor to update the formatting of each citation whenever someone makes changes to it. On large wikis like Wikipedia, this can cause annoying dirty diffs and even accidental edit wars with bots that maintain citations.
Duba nan
- Old Zotero translation server -- xpcshell-based Zotero translation server, and translation-server, a nodejs equivalent.
- Valid field names for each item type
- Zotero field mappings, including vs. some cite templates
- Citoid/Maps TemplateData
- en:Category:Citation_templates
- en:Help:Citation tools
- VisualEditor/Citation tool
- m:Research:Citoid support for Wikimedia references
- Translators testing
- Citoid/Enabling Citoid on your wiki
- Citoid/itemTypes
- Citoid/Zotero's Tech Talk
- James Forrester talks Citoid and Zotero at m:WikiCite 2017
Manazarta
- ↑ Saituna gama gari.php akan phabricator.wikimedia.org (ba a saita tuta)