From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Moe Subject: Re: HTML export and Zotero-friendly headers Date: Wed, 23 Nov 2011 11:37:47 +0100 Message-ID: <4ECCCCFB.7040104@christianmoe.com> References: <87r511qqwm.fsf@momotombo.lnouv.com> <4ECAB3CC.3080902@christianmoe.com> <87wratfaat.fsf@momotombo.lnouv.com> <4ECB6AF5.4040608@christianmoe.com> <87ehx0b4iz.fsf@momotombo.lnouv.com> Reply-To: mail@christianmoe.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:47706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTA9I-0000uH-Ft for emacs-orgmode@gnu.org; Wed, 23 Nov 2011 05:33:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RTA9H-0002ul-K9 for emacs-orgmode@gnu.org; Wed, 23 Nov 2011 05:33:52 -0500 Received: from b1.hitrost.net ([91.185.211.67]:51420) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTA9H-0002ub-94 for emacs-orgmode@gnu.org; Wed, 23 Nov 2011 05:33:51 -0500 In-Reply-To: <87ehx0b4iz.fsf@momotombo.lnouv.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Erik L. Arneson" Cc: emacs-orgmode@gnu.org On 11/22/11 3:44 PM, Erik L. Arneson wrote: >> Do I then understand correctly that what you want to do is simply to >> generate one COinS snippet with metadata about the document itself >> (author, title, etc.)? > > Yes, though it doesn't need to be only COinS. Zotero supports a number > of different formats, but COinS looks like it may be the easiest and the > most concise. > Hi, Does Org document header data include more than author, title, date, description and keywords. So I'd be inclined to go with Dublin Core for this, and just twin the ordinary META tags (which Zotero doesn't bother with, probably wisely) with DC equivalents. Doing it as below, with a hook at the end of html export, is more than a little clumsy, but it will do for testing purposes. If people think it's a good idea to do this in HTML exports on a permanent basis, a non-clumsy version could be patched into org-export-as-html. #+begin_src elisp (defun org-export-with-dc () "Add Dublin Core metadata from Org document headers to exported HTML. Comma-separated keywords and multiple authors separated with ` and ' will be correctly imported into Zotero. Note: For testing purposes only. It is only called as a hook from org-export-as-html, where it gets TITLE, DATE, AUTHOR, DESCRIPTION, and KEYWORDS values." (let ((creators (split-string author " and ")) (subjects (split-string keywords ", ?")) fdate) (when (string-match "[0-9]+-[0-9]+-[0-9]+" date) (setq fdate (match-string 0 date))) (goto-char (point-min)) (when (re-search-forward "") (goto-char (match-beginning 0)) (while creators (insert (format "\n" (car creators))) (setq creators (cdr creators))) (insert (format " \n" title fdate description)) (while subjects (insert (format "\n" (car subjects))) (setq subjects (cdr subjects)))))) (add-hook 'org-export-html-final-hook 'org-export-with-dc) #+end_src Yours, Christian