Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
dev:translator_development_outside_scaffold [2010/07/24 17:05] – sync with my emacs buffer tomrochewikidev:translator_development_outside_scaffold [2010/07/24 23:34] – more tomrochewiki
Line 59: Line 59:
 ===== Create or modify a translator file ===== ===== Create or modify a translator file =====
  
-One can +One can generate a completely new translator file using Scaffold 2.0. 
-  create a new translator file by copy/modify-ing an existing one. This may involve  +  - Start Scaffold. 
-  * work directly on an existing translator file (e.g. to fix a bug or add an feature) without modifying the ''translatorID''+  - In tab=Metadata, take the generated ''translatorID'', but give some values for the ''label'', ''creator'', and ''target'' fields. (Note your filename will be based on the value of the ''label'' field: e.g. if you set that to ''foo'', your file will be named ''foo.js''
 +  - In tab=Code, enter a ''detectWeb'' stub, e.g. <code>function detectWeb () { 
 +return "book"; 
 +
 +</code> 
 +  - Click on icon=Save (second from upper left). 
 +  - Check your translator filespace: you should have a new file with name based on field=''label''
 +  - Close Scaffold. You may do all subsequent work directly on the new file. 
 + 
 +However it is usually easier to create a new translator by copy/modify-ing an existing one. This can be done in one of several ways, including 
 +  - working directly on an existing translator file (e.g. to fix a bug or add an feature) without modifying the ''translatorID''. Note that any Zotero update to the profile containing that file will overwrite your work. 
 +  - "clearing out" your copy/modified file. Open it in your editor, and 
 +    - in the metadata block, 
 +      * create a new ''translatorID'' for your copy/modified file. Edit the old field randomly, or (better) generate a new value using Scaffold 2.0. 
 +      * make the value of the ''label'' field match your new filename. 
 +    - in the code section, clear out any undesired contents from the ''detectWeb'' and ''doWeb'' functions. 
 +  - somewhat "between" the previous two: 
 +    - Find an existing translator with functionality that resembles what you want. 
 +    - Copy that to a new file in your translator filespace. 
 +    - Open the new file and 
 +      - change the metadata field=''label'' to match your filename (minus the ''.js'' extension) 
 +      - assign a new value to field=''translatorID'', preferably after generating a new value using Scaffold 2.0. 
 +      - change the ''detectWeb'' and ''doWeb'' functions as needed.
  
 ===== Edit, run, test, debug ===== ===== Edit, run, test, debug =====
dev/translator_development_outside_scaffold.txt · Last modified: 2017/11/12 19:53 by 127.0.0.1