emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] zotero plain, org-odt, and citations in general


From: Jambunathan K
Subject: Re: [O] zotero plain, org-odt, and citations in general
Date: Thu, 10 Nov 2011 20:47:30 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (windows-nt)

>    1. org-zotero.el
>
>       This permits insertion of zotero reference links *only* and
>       opening them with a browser. 
>
>       Specifically I don't see the translator of these links to
>       individual backends like latex, html or more importantly ODT.
>
>       #+begin_src emacs-lisp
>         (org-add-link-type TYPE &optional FOLLOW EXPORT)
>       #+end_src
>
>    2. zotero.el
>
>       This (apparently) permits download of data from firefox and
>       importing it within Emacs.


I think I now have some understanding of what Erik's library does[1]. 

It creates a bibliographic entry (as in Footnotes) using Quick Copy.  It
doesn not create a footnote reference. One can use the Firefox Zotero
and see how Quick Copy works with both RTF and HTML formats[2].

[Question to Erik: Can one not use "Copy from Clipboard" from elisp
instead of going the mozrepl route to create a biblio.text]

Instead of working with JS libraries, I think the right starting point
would be to work with the underlying zotero.sqlite database itself. It
is not difficult to get a key of the selected item in Zotero
pane[3]. Once this is done the underlying zotero.sqlite database could
be queried for the item properties[4].

Fortunately there is already a GUI/Command line tool - Gnotero[5] -for
accessing the sqlite database.

As for exploiting the power of using zotero within libreoffice - which
is to have the same citation presented in different citation styles -
one need to look at how the reference marks are produced within
OpenDocument XML.

Here is a typical reference mark for an item with local zotero URL[6]:
zotero://report/items/579241_E7232HE2/html/report.html

LIBRARY=>579241
KEY=>E7232HE2


#+begin_src nxml
  <text:p text:style-name="Footnote">
    <text:reference-mark-start text:name="ZOTERO_ITEM 
{&quot;citationID&quot;:&quot;2lhcdnkups&quot;,&quot;citationItems&quot;:[{&quot;uri&quot;:[&quot;http://zotero.org/groups/51961/items/E7232HE2&quot;]}]}
 RNDB7mi3QiueI"/>Crew, “Alltagsgeschichte.”
    <text:reference-mark-end text:name="ZOTERO_ITEM 
{&quot;citationID&quot;:&quot;2lhcdnkups&quot;,&quot;citationItems&quot;:[{&quot;uri&quot;:[&quot;http://zotero.org/groups/51961/items/E7232HE2&quot;]}]}
 RNDB7mi3QiueI"/>
  </text:p>
#+end_src nxml

One can see the following components:
1. ZOTERO_ITEM 
2. citationID and citationItems
   - The citationItem has the following Zotero URI:
     http://zotero.org/groups/51961/items/E7232HE2
     
     GROUP=>51961
     KEY=>E7232HE2

     Note that the keys for the entry are the same on both the local
     zotero store and the global zotero URI.
3. RNDB7mi3QiueI
   - This is a cookie entered by Zotero which maps the citation entry to
     an entry in the zotero database. Note that it starts with RND.

     This is what is called as a "FieldCode" in zotero parlance.

     Note: Have you seen the "Remove Field Codes" in Zotero menu within
     ODT document. Once you remove the field codes the document becomes
     a simple ODT document and one would no longer be able to move
     between different citation styles.

     In essence, "Field Code" is the MAGIC WAND that zotero uses.

>From my little research, I can say with confidence that global zotero
URIs and the above mentioned reference marks are *very* recent
developments.

Exercising the MAGIC WAND within ODT exporter requires diving in to
zotero server inner workings - which is non-trivial as Erik notes - but
would also be futile (as in chasing a shifting sand)

I believe the best course would be to do convention/static footnoting
with the simplest of Chicago styles using a choice of entry types like
Article, Journal, Book or a Website.

Proposal for Org+Zotero integration
===================================

An org document like this

--8<---------------cut here---------------start------------->8---
#+begin_src org
* Headline
  This is a footnote reference[1]

Footnotes:
[1] zotero://report/items/579241_E7232HE2/html/report.html
#+end_src org
--8<---------------cut here---------------end--------------->8---

will be transformed to this on ODT export

--8<---------------cut here---------------start------------->8---
#+begin_odt
* Headline
  This is a footnote reference[1]     

Bibliography:

1. David F. Crew, “Alltagsgeschichte: A New Social History ‘From
below’?,” Central European History 22, no. 3/4 (1989): 394-407.
#+end_odt
--8<---------------cut here---------------end--------------->8---

Note that the footnote link is an org stlye link captured with
org-protocol and has both a LIBRARY_ID and KEY_ID. The bibliography
entry will be generated by "exporting" zotero link to the required
format using a variation of gnotero. The "following/opening" of zotero
link will be done by mapping the local zotero link to
http://zotero.org-based URI (again) using gnotero.


I see that there is a need for bib2odt in much the same way as there is
a bib2html. Can someone post an example of Org file which would use
BibTex for post-processing (either to HTML or LaTeX) The ODT exporter
can also emulate what other backend does.

ps: This mail is more of a note to self or a note to any future
hackers. I am not certain I will be able to hack gnotero and have it
integrate with Emacs - but for a whimsical and a bored hacker like
nothing can be said with certainty.

Btw, gnotero is good. Not sure how usable it is though ...

Jambunathan K.

Footnotes: 

[1]  With Mozrepl 1.1 beta2 on Firefox 3.6.23, I am unable to make
org-zotero.el work. It hangs and I have to C-g out (Christian! you are
not alone). I am able to get as far as creating the LIBRARY_KEY for the
selected item in the zotero pane and not further.

[2] Quick Copy: http://www.zotero.org/support/creating_bibliographies

[3] For producing ITEM keys: One could use zotero.el or simply "Right
Click" on an item and do a "Generate Report from Selected Item". The
resulting url in firefox could be captured using org-protocol and
imported in to the org buffer. A typical URL looks like this:

zotero://report/items/0_6EETTDBE/html/report.html
0 => My Library
6EETTDBE => Key of the selected item

or 
zotero://report/items/579241_E7232HE2/html/report.html
579241 => The local library key for "Digital Humanities UofT group"
E7232HE2 => Key of the selected item.

[4]  For locating zotero.sqlite and querying it with Sqlite Manager see
- https://www.zotero.org/utils/dbfix/
- http://kimmonsdesign.com/node/24

[5]  http://cogsci.nl/software/qnotero
http://www.cogsci.nl/blog/tutorials/97-writing-a-command-line-zotero-client-in-9-lines-of-code
http://files.cogsci.nl/software/gnotero/extras/gnotero_cmdline.py

[6]  See the attached zotero-libreoffice.odt

Attachment: zotero-libreoffice.odt
Description: zotero-libreoffice.odt

-- 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]