Many thanks, Frank! :-)
I have made a bookmarklet using citeproc-js. Quite easy with you help:
https://dl.dropboxusercontent.com/u/848981/it/citep/citeproc-bm-setup.htmlThe output part is working rather well, but the scraping part is not there yet.
(Though I do not understand the "locale" part of the output. I just use locales-en-US.xml at the moment. I would be glad for some help there.)
The scraper. I do not know what to do at the moment. The code is organised like this:
- The bookmarklet makes a string copy of the page DOM.
- A new window is opened which loads citeproc.js etc.
- The bookmaklet uses postMessage to send the string copy of the page, csl and locale to the new window.
- The new window uses DOMParser to recreate a DOM which is then used for scraping.
- The result of the scraping is then (of course) used as data citeproc.js.
This setup actually technically allows for fetching relevant JavaScript code from for example Zotero and do the scraping. I mean, there are no security concerns, you can just add the relevant code as new script tags to the new window.
Of course then the translators must be organized so that this is possible.
At the moment I am trying to understand if the Zotero translators in their current forms can be used directly or if some changes must be made. Could someone please help me a bit there?
In another thread I told about a rewrite of the Zotero bookmarklet. That works, but my proxy is down at the moment (see
https://dl.dropboxusercontent.com/u/848981/it/zotero-connectors/build/bookmarklet/bookmarklet.html). However this new approach seems much easier. No sandboxing is needed for example, AFAICS.