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:coding [2018/09/27 20:06] adamsmithdev:translators:coding [2018/12/26 06:49] – Add proxy: false attachment flag dstillman
Line 76: Line 76:
 document:doc});</code> document:doc});</code>
  
 +Zotero will automatically use proxied versions of attachment URLs returned from translators when the original page was proxied, which allows translators to construct and return attachment URLs without needing to know whether proxying is in use. However, some sites expect unproxied PDF URLs at all times, causing PDF downloads to potentially fail if requested via a proxy. If a PDF URL is extracted directly from the page, it's already a functioning link that's proxied or not as appropriate, and a translator should include ''proxy: false'' in the attachment metadata to indicate that further proxying should not be performed:
 +
 +<code javascript>
 +item.attachments.push({
 + url:realpdf,
 + title: "EBSCO Full Text",
 + mimeType:"application/pdf",
 + proxy: false
 +});
 +</code>
  
 === Notes === === Notes ===
Line 187: Line 197:
 Export translators use ''Zotero.nextItem()'' and optionally ''Zotero.nextCollection()'' to iterate through the items selected for export, and generally write their output using ''Zotero.write( text )''. A minimal translator might be: Export translators use ''Zotero.nextItem()'' and optionally ''Zotero.nextCollection()'' to iterate through the items selected for export, and generally write their output using ''Zotero.write( text )''. A minimal translator might be:
 <code javascript> <code javascript>
-var item; +function doExport() { 
-while (item = Zotero.nextItem()) { +    var item; 
-     Zotero.write( item.title );+    while (item = Zotero.nextItem()) { 
 +        Zotero.write(item.title); 
 +    }
 } }
 </code> </code>
dev/translators/coding.txt · Last modified: 2023/08/04 01:14 by dstillman