emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Price <moptop99@gmail.com>
To: "Monroe, Will" <will.monroe@law.lsu.edu>,
	Org Mode <emacs-orgmode@gnu.org>
Subject: Re: exporting zotxt or orgref links to HTML and ODF
Date: Mon, 26 Jan 2015 15:40:35 -0500	[thread overview]
Message-ID: <CAN_Dec-+xu1ft9sEG3gKhZJcbzZaLQ8X8PBGwoqHs04Uw7sDdA@mail.gmail.com> (raw)
In-Reply-To: <54C67E1A.8080706@law.lsu.edu>

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

Hi will,

I haven't gotten very far with this yet, but adding a couple of lines to
the definition of org-add-link-type in org-zotxt.el (around line 150,
https://bitbucket.org/egh/zotxt-emacs/src/74702e2b2f2aa0427f099eb4fe69dce8709f67fc/org-zotxt.el?at=master)
at least allows for unformatted, plain-text reproduction of citations:

------------------
(org-add-link-type "zotero"
                   (lambda (rest)
                     (zotxt-select-key (substring rest 15)))
                   (lambda (path desc format)
                     (if (and (eq format 'latex)
                              (string-match "^@\\(.*\\)$" desc))
                         (format "\\cite{%s}" (match-string 1 desc))
                       nil)
                     (if ( eq format 'html)
                         (format "%s" desc)

                       nil)))
-------------------

A better option would be to somehow acquire the html that the Zotero
extension "zotxt" generates when zotxt.el requests the formatted citation
from it.  I'm not quite sure how to do this, but I htink the action happens
zotxt-choose-deferred, which starts on line 125 of zotxt.el (
https://bitbucket.org/egh/zotxt-emacs/src/74702e2b2f2aa0427f099eb4fe69dce8709f67fc/zotxt.el?at=master
):

---------------------

(defun zotxt-choose-deferred (&optional method search-string)  "Prompt
a user for a search string, then ask the user to select an item from
the citation.If METHOD is supplied, it should be one of
:title-creator-year, :fields, or :everything.If SEARCH-STRING is
supplied, it should be the search string."  (if (null method)
(let ((method-name              (zotxt-completing-read
"Zotero search method (nothing for title, creator, year): "
  zotxt-quicksearch-method-names              nil t nil nil "title,
creator, year")))        (setq method (cdr (assoc method-name
zotxt-quicksearch-method-names)))))  (if (null search-string)
(setq search-string            (read-string (format "Zotero
quicksearch (%s) query: " (cdr (assq method
zotxt-quicksearch-method-to-names))))))  (lexical-let ((d
(deferred:new)))    (request     (format "%s/search" zotxt-url-base)
  :params `(("q" . ,search-string)               ("method" . ,(cdr
(assq method zotxt-quicksearch-method-params)))
("format" . "bibliography"))     :parser 'json-read     :success
(function*               (lambda (&key data &allow-other-keys)
        (let* ((results (mapcar (lambda (e)
                (cons (cdr (assq 'text e))
                     (cdr (assq 'key e))))
            data))                        (count (length results))
                   (citation (if (= 0 count)
           nil                                    (if (= 1 count)
                                  (car (car results))
                    (zotxt-completing-read "Select item: " results))))
                       (key (cdr (assoc-string citation results))))
               (deferred:callback-post                     d (if (null
citation) nil                         `((:key ,key :citation
,citation))))))))    d))

-------------

My lisp isn't good enough to read this function properly, but apparently the
:citation property of the result item plist is set to the 'text'
object of each item.
If one could  also add the 'html' object which the zotxt Zotero plugin returns
(the nomenclature is a little misleading, I know), then that
information could be made available to emacs/org
for use on export.  See line 307-309 of the zotxt extension, here:
 https://bitbucket.org/egh/zotxt/src/a12d538ae9245b142fdb55550b2d241e43b82221/extension/bootstrap.js?at=master

Not sure if this helps much?  It's the best I have so far!  Thanks,
Matt



On Mon, Jan 26, 2015 at 12:49 PM, Monroe, Will <will.monroe@law.lsu.edu>
wrote:

>  Matt,
>
> I don't have much to contribute at this stage but as someone who uses org
> heavily for outlining and writing, zotero for citation management, and who
> is obliged to provide copies as Word documents (I'm an instructional
> designer at at law school), I appreciate the question.
>
> I also appreciate the point to zotxt!  Didn't know about that.
>
> I hope you get some good replies.
>
> Will
>
> -----------------------------
> Will Monroe, Ph.D.
> Head of Instructional Technology
> Paul M. Hebert Law Center
> 225.578.7838
> will.monroe@law.lsu.edu
>
> On 1/26/15 10:29 AM, Matt Price wrote:
>
>   Hi eveyrone,
>
>  I've just looked back through my email archives and from what I can tell,
> almost everyone who uses Org to write papers uses LaTex for the final
> product.
>
>  I have never learned to use Latex, mostly because, as a humanist, almost
> none of my colleagues can use LaTex files, and the same goes for journals I
> interact with, which generally prefer Word submission(!).  Because of this,
> I am still trying to figure out a way to use org-mode for scholarly
> writing. At present, I write my first, very rough drafts in Org, then
> export to ODT and add citations from Zotero (we don't really use Bibtex
> either); after this step, I can't really go back to Org, which is of course
> very frustrating.
>
>
>  I would prefer to write exclusively in Org, then export to ODT when I
> have a high-quality draft that I want to share with colleagues; in some
> cases, I would also like to export directly to HTML for posting on a blog
> or course website. In fact, one use case that would really help me is a
> very simple one: when writing course syllabi, I would really like to just
> get the full references to course readings to show up in HTML exports.
>
>  My question: does anyone yet have a workflow that lets them export
> directly to HTML or ODT?
>
>  I've just tried using zotxt again (
> https://bitbucket.org/egh/zotxt-emacs/overview -- first time in a while);
> it is remarkably easy to use in Org itself.  By default, though, the links
> simply aren't handled in the HTML and ODT exports, and so the cites will be
> completely absent.
>
>  Here is the text inserted by zotxt for a single citation:
>
> ----------------
>
> [[zotero://select/items/0_TI27HJ5I][Suchman, Lucy. “Subject Objects.”
> Feminist Theory 12, no. 2 (August 1, 2011): 119–45.
> http://resolver.scholarsportal.info/resolve/14647001/v12i0002/119_so.xml.]]
>
> ---------------
>
>  In HTML, I would like to replace this with something like this:
>
>  (<a href="#BibSuchman2011">Suchman 2011</a>)
>
>  and then have Org generate a bibligraphy somewhere, a bit like org-ref
> seems to do, It would be nice if I could steal the styles from somehwere,
> the way org-ref seems to do.
>
>  For ODT< it seems a little more complicated. Here is the rather lengthy
> equivalent that Zotero itself produces for my default style (Chicago) in
> Libreoffice:
> ---------------
> <text:note text:id="ftn0"
> text:note-class="footnote"><text:note-citation>1</text:note-citation><text:note-body><text:p
> text:style-name="Footnote"><text:reference-mark-start
> text:name="ZOTERO_ITEM CSL_CITATION
> {&quot;citationID&quot;:&quot;5xzXuF2I&quot;,&quot;properties&quot;:{&quot;formattedCitation&quot;:&quot;{\\rtf
> Lucy Suchman, \\uc0\\u8220{}Subject Objects,\\uc0\\u8221{} \\i Feminist
> Theory\\i0{} 12, no. 2 (August 1, 2011): 119\\uc0\\u8211{}45,
> http://resolver.scholarsportal.info/resolve/14647001/v12i0002/119_so.xml.}&quot;,&quot;plainCitation&quot;:&quot;Lucy
> Suchman, “Subject Objects,” Feminist Theory 12, no. 2 (August 1, 2011):
> 119–45,
> http://resolver.scholarsportal.info/resolve/14647001/v12i0002/119_so.xml.&quot;
> },&quot;citationItems&quot;:[{&quot;id&quot;:149,&quot;uris&quot;:[&quot;
> http://zotero.org/users/20/items/TI27HJ5I&quot;],&quot;uri&quot;:[&quot;
> http://zotero.org/users/20/items/TI27HJ5I&quot;],&quot;itemData&quot;:{&quot;id&quot;:149,&quot;type&quot;:&quot;article-journal&quot;,&quot;title&quot;:&quot;Subject
> objects&quot;,&quot;container-title&quot;:&quot;Feminist
> Theory&quot;,&quot;page&quot;:&quot;119-145&quot;,&quot;volume&quot;:&quot;12&quot;,&quot;issue&quot;:&quot;2&quot;,&quot;URL&quot;:&quot;
> http://resolver.scholarsportal.info/resolve/14647001/v12i0002/119_so.xml&quot
> ;,&quot;ISSN&quot;:&quot;14647001&quot;,&quot;author&quot;:[{&quot;family&quot;:&quot;Suchman&quot;,&quot;given&quot;:&quot;Lucy&quot;}],&quot;issued&quot;:{&quot;date-parts&quot;:[[&quot;2011&quot;,8,1]]}}}],&quot;schema&quot;:&quot;
> https://github.com/citation-style-language/schema/raw/master/csl-citation.json&quot;}
> RNDuhNYYpC1hN"/><text:span text:style-name="T3">Lucy Suchman, “Subject
> Objects,” </text:span><text:span text:style-name="T4">Feminist
> Theory</text:span><text:span text:style-name="T5"> 12, no. 2 (August 1,
> 2011): 119–45,
> http://resolver.scholarsportal.info/resolve/14647001/v12i0002/119_so.xml.</text:span><text:reference-mark-end
> text:name="ZOTERO_ITEM CSL_CITATION
> {&quot;citationID&quot;:&quot;5xzXuF2I&quot;,&quot;properties&quot;:{&quot;formattedCitation&quot;:&quot;{\\rtf
> Lucy Suchman, \\uc0\\u8220{}Subject Objects,\\uc0\\u8221{} \\i Feminist
> Theory\\i0{} 12, no. 2 (August 1, 2011): 119\\uc0\\u8211{}45,
> http://resolver.scholarsportal.info/resolve/14647001/v12i0002/119_so.xml.}&quot;,&quot;plainCitation&quot;:&quot;Lucy
> Suchman, “Subject Objects,” Feminist Theory 12, no. 2 (August 1, 2011):
> 119–45,
> http://resolver.scholarsportal.info/resolve/14647001/v12i0002/119_so.xml.&quot;
> },&quot;citationItems&quot;:[{&quot;id&quot;:149,&quot;uris&quot;:[&quot;
> http://zotero.org/users/20/items/TI27HJ5I&quot;],&quot;uri&quot;:[&quot;
> http://zotero.org/users/20/items/TI27HJ5I&quot;],&quot;itemData&quot;:{&quot;id&quot;:149,&quot;type&quot;:&quot;article-journal&quot;,&quot;title&quot;:&quot;Subject
> objects&quot;,&quot;container-title&quot;:&quot;Feminist
> Theory&quot;,&quot;page&quot;:&quot;119-145&quot;,&quot;volume&quot;:&quot;12&quot;,&quot;issue&quot;:&quot;2&quot;,&quot;URL&quot;:&quot;
> http://resolver.scholarsportal.info/resolve/14647001/v12i0002/119_so.xml&quot
> ;,&quot;ISSN&quot;:&quot;14647001&quot;,&quot;author&quot;:[{&quot;family&quot;:&quot;Suchman&quot;,&quot;given&quot;:&quot;Lucy&quot;}],&quot;issued&quot;:{&quot;date-parts&quot;:[[&quot;2011&quot;,8,1]]}}}],&quot;schema&quot;:&quot;
> https://github.com/citation-style-language/schema/raw/master/csl-citation.json&quot;}
> RNDuhNYYpC1hN"/></text:p></text:note-body></text:note>
> ------------------------------
>
>  I'm not sure what the best way to do this is; it may be that zotxt could
> be extended to get zotero to do the heavy lifting here.
>
>  I know Erik H reads this list, so if you have any suggestions, Erik, I
> would love to hear them.  But maybe other people also have suggestions
> about modifying export filters - -that would also be really helpful for
> me.  Thanks as always,
>
> Matt
>
>
>

[-- Attachment #2: Type: text/html, Size: 22605 bytes --]

  parent reply	other threads:[~2015-01-26 20:40 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 16:29 exporting zotxt or orgref links to HTML and ODF Matt Price
     [not found] ` <54C67E1A.8080706@law.lsu.edu>
2015-01-26 20:40   ` Matt Price [this message]
2015-01-26 21:53     ` Monroe, Will
2015-01-27  8:25 ` Eric S Fraga
2015-01-27  9:23 ` Christian Moe
2015-01-27 13:30   ` Rasmus
2015-01-27 13:51     ` Matt Price
2015-01-27 14:14       ` Rasmus
2015-01-27 18:17         ` John Kitchin
2015-01-27 15:24       ` Christian Moe
2015-01-27 17:24     ` Richard Lawrence
2015-01-27 17:50       ` Rasmus
2015-01-28  4:09         ` Richard Lawrence
2015-01-27 20:01       ` Christian Moe
2015-01-27 22:08         ` Rasmus
2015-01-27 22:15         ` John Kitchin
2015-01-28  2:10         ` Matt Price
2015-01-28  6:37       ` Erik Hetzner
2015-02-01  4:20         ` Erik Hetzner
2015-01-27 12:01 ` Vikas Rawal
2015-01-27 13:12   ` Matt Price
2015-01-27 14:28     ` Eric S Fraga
2015-01-27 13:31   ` Albert Krewinkel
     [not found] ` <m2vbjsvay0.fsf@christianmoe.com>
     [not found]   ` <CAN_Dec9qBWWWgdX+wQhdgbthMg_ZOgbOMFoXFixSc4=74avMjw@mail.gmail.com>
2015-01-27 14:41     ` Christian Moe
     [not found] <CAMfbzvA83eSWe79Ot=yX+_s_g33gpLnP-z+zQ52QFJm+iJTR+Q@mail.gmail.com>
2015-01-28 21:53 ` Matt Price
2015-01-28 23:01   ` John Kitchin
2015-01-29  1:34     ` Matt Price
2015-01-29  1:48       ` John Kitchin
     [not found]         ` <CAN_Dec80Su+5Nh5mqNxBXsLu_gm93aY77B=2Zrce-TJ1RPKCig@mail.gmail.com>
2015-01-29 13:06           ` John Kitchin
2015-01-29 13:11             ` Vikas Rawal
2015-01-29 13:24               ` John Kitchin
2015-01-29 13:39                 ` Vikas Rawal
2015-01-29 13:09       ` John Kitchin
2015-01-29  2:26     ` Vikas Rawal

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=CAN_Dec-+xu1ft9sEG3gKhZJcbzZaLQ8X8PBGwoqHs04Uw7sDdA@mail.gmail.com \
    --to=moptop99@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=will.monroe@law.lsu.edu \
    /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).