emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: Matt Price <moptop99@gmail.com>
Cc: Erik Hetzner <egh@e6h.org>, Org Mode <emacs-orgmode@gnu.org>,
	mail@christianmoe.com
Subject: Re: zotero plain, org-odt, and citations in general
Date: Thu, 10 Nov 2011 20:47:30 +0530	[thread overview]
Message-ID: <81mxc4ovlh.fsf@gmail.com> (raw)
In-Reply-To: <81hb2drhmu.fsf@gmail.com> (Jambunathan K.'s message of "Wed, 09 Nov 2011 10:56:17 +0530")

[-- Attachment #1: Type: text/plain, Size: 6860 bytes --]


>    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 #2: zotero-libreoffice.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 13866 bytes --]

[-- Attachment #3: Type: text/plain, Size: 5 bytes --]


-- 

  reply	other threads:[~2011-11-10 15:18 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-09  2:06 zotero plain, org-odt, and citations in general Matt Price
2011-11-09  5:26 ` Jambunathan K
2011-11-10 15:17   ` Jambunathan K [this message]
2011-11-10 15:50     ` Thomas S. Dye
2011-11-10 17:48     ` Erik Hetzner
2011-11-11 15:51       ` Matt Price
2011-11-11 16:12         ` Erik Hetzner
2011-11-11 18:45           ` Matt Price
2011-11-12  0:07             ` Erik Hetzner
2011-11-12 23:45           ` Christian Moe
2011-11-12 23:46             ` Christian Moe
2011-11-11 20:34       ` zotero-cite (A Proposal) Jambunathan K
2011-11-14 15:38         ` Matt Price
2011-11-16  5:25         ` Erik Hetzner
2011-11-11 21:13       ` zotero plain, org-odt, and citations in general Jambunathan K
2011-11-12  7:21         ` Christian Moe
2011-11-12 14:20           ` Matt Price
2011-11-16  5:30         ` Erik Hetzner
2011-11-09  7:03 ` Erik Hetzner
2011-11-09  7:25   ` Jambunathan K
2011-11-09 14:13     ` Ken Williams
2011-11-09 19:39       ` Christian Moe
2011-11-10  4:53         ` Erik Hetzner
2011-11-10  9:01           ` Christian Moe
2011-11-11 15:37         ` Matt Price
2011-11-11 17:51           ` Erik Hetzner
2011-11-11 18:34             ` Matt Price
2011-11-09 15:28     ` Matt Price
2011-11-10  4:40       ` Erik Hetzner
2011-11-13 22:47 ` Christian Moe
2011-11-14 15:38   ` Matt Price

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81mxc4ovlh.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=egh@e6h.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@christianmoe.com \
    --cc=moptop99@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).