Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
dev:translators_reference_guide [2011/01/28 09:31] rmzelledev:translators_reference_guide [2016/07/26 17:31] – replace dead link owcz
Line 12: Line 12:
     * [[http://xpath.alephzarro.com/|XPather]]/[[https://addons.mozilla.org/en-US/firefox/addon/6622|DOM Inspector]] - XPather, which requires the DOM Inspector extension to be installed, is mostly useful for testing XPaths. Recommended in combination with Firebug.     * [[http://xpath.alephzarro.com/|XPather]]/[[https://addons.mozilla.org/en-US/firefox/addon/6622|DOM Inspector]] - XPather, which requires the DOM Inspector extension to be installed, is mostly useful for testing XPaths. Recommended in combination with Firebug.
  
-===== Translator Metadata ===== 
- 
-Each translator is described by several metadata fields. For the stand-alone javascript translator files in Zotero 2.0, this metadata is included at the beginning of the file in a JSON block, e.g.: 
- 
-<code>{ 
- "translatorID":"fcf41bed-0cbc-3704-85c7-8062a0068a7a", 
- "translatorType":12, 
- "label":"NCBI PubMed", 
- "creator":"Simon Kornblith and Michael Berkowitz", 
- "target":"http://[^/]*www\\.ncbi\\.nlm\\.nih\\.gov[^/]*/(pubmed|sites/entrez|entrez/query\\.fcgi\\?.*db=PubMed)", 
- "minVersion":"1.0.0b3.r1", 
- "maxVersion":"", 
- "priority":100, 
- "inRepository":true, 
- "lastUpdated":"2008-12-15 00:25:00" 
-}</code> 
- 
-A description of the metadata fields: 
- 
-  * **translatorID** \\ The internal ID by which Zotero identifies the translator. It is recommended to use a [[http://en.wikipedia.org/wiki/Globally_Unique_Identifier|GUID]] (GUIDs can be automatically generated in [[scaffold|Scaffold]]). As the translatorID is used for automatic updating of translators, and for calling translators within other translators, using stable GUIDs is strongly recommended. 
-  * **translatorType** \\ Four types of translator exist, web translators being the most common. The four types are: import (1), export (2), web (4) and search (8). The value of translatorType should be the number listed after the relevant type. Some translators belong to multiple types. In those cases, the value of translatorType is the sum of the types (e.g. an web/search translator will have a translatorType value of 12). In [[scaffold|Scaffold]] the translatorType is set with checkboxes. 
-  * **label** \\ The name of the translator 
-  * **creator** \\ The author(s) of the translator 
-  * **target** \\ For web translators, the target should specify a [[https://developer.mozilla.org/En/Core_JavaScript_1.5_Guide/Regular_Expressions|Javascript regular expression]]. Whenever a page is loaded, Zotero tests the target regular expressions of all web translators on the webpage URL. Of the matching translators, the translator with the lowest priority number will be used for that page. The translator's DetectCode function is run, and a Zotero item icon will appear in the address bar if an item is found. 
-  * **minVersion** \\ The minimum version of Zotero for which the translators works properly 
-  * **maxVersion** \\ The maximum version of Zotero for which the translators works properly 
-  * **priority** \\ The priority number is used to determine which translator should be used, if multiple translators are found to be able to translate a certain web page. A lower number indicates a higher priority. 
-  * **inRepository** \\ FIXME This probably indicates whether the translator is shipped with Zotero. 
-  * **lastUpdated** \\ The date and time when the translator was last modified (format YYYY-MM-DD HH:MM:SS). Scaffold automatically updates this fields when the translator is saved (or run). 
  
 ===== Zotero.Utilities ===== ===== Zotero.Utilities =====
Line 226: Line 197:
 Especially for screen scraper translators, knowing which item types (''book'', ''journalArticle'', etc) and item fields (''title'', ''url'', etc) exist in Zotero can be very helpful. Fortunately, the possible item properties can be found in the following source code file (types are listed as "itemTypes" entries, fields as "itemFields"): Especially for screen scraper translators, knowing which item types (''book'', ''journalArticle'', etc) and item fields (''title'', ''url'', etc) exist in Zotero can be very helpful. Fortunately, the possible item properties can be found in the following source code file (types are listed as "itemTypes" entries, fields as "itemFields"):
  
-https://www.zotero.org/trac/browser/extension/branches/2.0/chrome/locale/en-US/zotero/zotero.properties#L240+http://aurimasv.github.io/z2csl/typeMap.xml
  
 Note that the different item types make use of different combinations of item fields (e.g. the ''book'' item type has the field ''ISBN'', while the ''journalArticle'' item type lacks this field). Note that the different item types make use of different combinations of item fields (e.g. the ''book'' item type has the field ''ISBN'', while the ''journalArticle'' item type lacks this field).
dev/translators_reference_guide.txt · Last modified: 2017/11/12 19:53 by 127.0.0.1