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
dev:scaffold [2009/06/29 01:55] – Kansas Is Going Bye-Bye (removed translator how-to, too much duplication with other sources) rmzelledev:scaffold [2018/05/07 13:09] (current) bwiernik
Line 1: Line 1:
-====== Scaffold - an IDE for Zotero translators ====== +See [[dev/translators/Scaffold]].
- +
-Scaffold is a Firefox extension developed to simplify writing Zotero translators. In Zotero 1.0.x, translators are stored in a single SQL database. Scaffold makes it easy to extract translators from this database, to edit and test translator code, and to save changes back into the database. +
- +
-===== Installation ===== +
- +
-[[/download/plugins/Scaffold-1.0.2.xpi|{{download_medium.gif}}]] \\ Current version: 1.0.2 (July 21, 2008) +
- +
-**Please note:** As of yet, Scaffold is only compatible with Zotero 1.0.x. Users of Zotero 2.0 can edit translators directly, as in that version translators are stored as individual text files in the 'translators' subdirectory of the [[:zotero_data|Zotero data directory]]. +
- +
-===== Interface ===== +
- +
-After installation, the Tools menu in Firefox should contain a "Scaffold" item. Select this item and to open the main Scaffold window: +
- +
-{{:dev:scaffold_main.png?nocache&nolink|}} +
- +
-==== Top buttons ==== +
- +
-{{:dev:database_edit.png?nocache&nolink|}} **Load from Database** \\  +
-Opens the "Load Translator" window. Select one of the currently installed translators, and load the translator metadata and code into the main Scaffold window. +
- +
-{{:dev:database_save.png?nocache&nolink|}} **Save to Database** \\ +
-Saves the translator you are currently working on to the database. Be sure to provide a unique label and Translator ID for your translator if you don't want to overwrite the existing translator. Translator IDs can be automatically generated via the "Generate" button. +
- +
-{{:dev:page_white_copy.png?nocache&nolink|}} **Copy to Clipboard** \\  +
-This copies the entire translator to the clipboard. The translator is formatted as an SQL statement so it can be inserted into scrapers.sql (the Zotero 1.0.x database containing all translators). +
- +
-{{:dev:lightning.png?nocache&nolink|}} **Execute** \\  +
-Saves and runs translator code on the webpage loaded in the most recently selected tab. The exact behavior depends on the selected Scaffold tab. If the "Metadata" tab is selected, the translator is only saved. If the "Detect Code" or "Code" tab is selected, the translator is saved, after which the code in the currently selected tab is executed. +
- +
-==== Tabs ==== +
- +
-**Metadata** \\ Here you provide metadata of the translator. Translator IDs can be automatically generated via the "Generate" button. The target Regex can be tested with the "Test Regex" button. +
- +
-**Detect Code** \\ The text-field of this tab should contain the detectWeb function for web translators, as well as any functions detectWeb calls. +
- +
-**Code** \\ The text-field of this tab should contain the doWeb function for web translators, as well as any functions doWeb calls. +
- +
-==== Debug Output ==== +
- +
-One of the strengths of Scaffold is its ability to provide you with immediate feedback, which can dramatically speed up translator development. After a code change, a single click suffices to run the modified translator and generate debug output. For each of the three tabs of Scaffold, a different type of debug output is generated: +
- +
-=== Metadata === +
-When the "Test Regex" button in the Metadata tab is clicked, the regular expression in the target field is applied to the webpage loaded in the most recently selected Firefox tab. The debug window at the bottom of the Scaffold window will show whether the regular expression matches (''true'' for a match, ''false'' for no match), e.g.: +
- +
-<code> +
-09:54:11 ===>true<===(boolean) +
-</code> +
- +
-=== Detect Code & Code === +
- +
-When the execute button is clicked while the "Detect Code"-tab is active, the detectWeb function in the "Detect Code"-text box will be executed. If the "Code"-tab is active, the doWeb in the "Code"-text box is executed. +
- +
-Debug output for the "Detect Code"-tab will show what type of item is found on the loaded webpage, e.g.: +
- +
-<code> +
-19:19:43 detectCode returned type "book" +
-</code> +
- +
-Debug output for the "Code"-tab will show what all the item data that would be saved if the translator would be run by Zotero, e.g.: +
- +
-<code> +
-19:24:21 Returned item: +
-             'itemType' => "book" +
-             'creators' ... +
-                 '0' ... +
-                     'firstName' => "Herman" +
-                     'lastName' => "Melville" +
-                     'creatorType' => "author" +
-             'notes' ... +
-             'tags' ... +
-             'seeAlso' ... +
-             'attachments' ... +
-                 '0' ... +
-                     'title' => "Google Books Link" +
-                     'snapshot' => "false" +
-                     'mimeType' => "text/html" +
-                     'url' => "http://books.google.com/books?id=cYKYYypj8UAC" +
-                     'document' => "[object]" +
-             'date' => "1851" +
-             'pages' => "504" +
-             'ISBN' => "1603033742, 9781603033749" +
-             'publisher' => "Plain Label Books" +
-             'title' => "Moby Dick" +
-             'repository' => "Google Books" +
-             'complete' => function(...){...}  +
-          +
-19:24:21 Translation successful +
-</code> +
- +
-If running detectWeb or doWeb results in an error, the debug window will show an error message. +
- +
-Note that additional debug output can be generated by the javascript command ''Zotero.debug(string);''+
- +
-=== Test Frame === +
- +
-FIXME What is the purpose of the Test Frame drop-down menu? +
- +
-===== Getting your translator distributed ===== +
- +
-If your new or modified translator has general appeal, consider posting the translator to the [[http://groups.google.com/group/zotero-dev|Zotero developers mailing list]]. +
- +
-refer to http://forums.zotero.org/discussion/6533/scaffold-in-firefox-31/?Focus=28305#Comment_28305 +
- +
dev/scaffold.1246254954.txt.gz · Last modified: 2009/06/29 01:55 by rmzelle