From: Christian Moe <mail@christianmoe.com>
To: "Erik L. Arneson" <dybbuk@lnouv.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: HTML export and Zotero-friendly headers
Date: Wed, 23 Nov 2011 11:37:47 +0100 [thread overview]
Message-ID: <4ECCCCFB.7040104@christianmoe.com> (raw)
In-Reply-To: <87ehx0b4iz.fsf@momotombo.lnouv.com>
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 "</head>")
(goto-char (match-beginning 0))
(while creators
(insert
(format "<meta name=\"DC.Creator\" content=\"%s\"/>\n"
(car creators)))
(setq creators (cdr creators)))
(insert
(format
"<meta name=\"DC.Title\" content=\"%s\"/>
<meta name=\"DC.Date\" content=\"%s\"/>
<meta name=\"DC.Description\" content=\"%s\"/>\n"
title fdate description))
(while subjects
(insert
(format "<meta name=\"DC.Subject\" content=\"%s\"/>\n"
(car subjects)))
(setq subjects (cdr subjects))))))
(add-hook 'org-export-html-final-hook 'org-export-with-dc)
#+end_src
Yours,
Christian
next prev parent reply other threads:[~2011-11-23 10:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-21 18:19 HTML export and Zotero-friendly headers Erik L. Arneson
2011-11-21 20:25 ` Christian Moe
2011-11-21 21:14 ` Erik L. Arneson
2011-11-22 4:54 ` Erik Hetzner
2011-11-22 9:27 ` Christian Moe
2011-11-22 14:44 ` Erik L. Arneson
2011-11-22 18:35 ` adam.smith
2011-11-22 20:49 ` Christian Moe
2011-11-23 10:37 ` Christian Moe [this message]
2011-11-23 16:45 ` Erik L. Arneson
2011-11-23 17:56 ` Christian Moe
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=4ECCCCFB.7040104@christianmoe.com \
--to=mail@christianmoe.com \
--cc=dybbuk@lnouv.com \
--cc=emacs-orgmode@gnu.org \
/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).