emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christian Moe <mail@christianmoe.com>
To: Jambunathan K <kjambunathan@gmail.com>, Org Mode <emacs-orgmode@gnu.org>
Subject: [ODT] [BUG?] Custom links are formatted as for html
Date: Sat, 12 Nov 2011 20:33:29 +0100	[thread overview]
Message-ID: <4EBECA09.3030301@christianmoe.com> (raw)

Hi, Jambunathan,

When I try to define a custom link type with special formatting for 
ODT export, the exporter behaves as if the backend is html.

I'll exemplify with a tweaked version of org-bbdb-export, since that's 
the textbook example of a custom link. I've rewritten it below so that 
if the export FORMAT is 'odt, BBDB links should be in bold.

(defun org-bbdb-export (path desc format)
   "Create the export version of a BBDB link specified by PATH or DESC.
If exporting to either HTML or LaTeX FORMAT the link will be
italicized, in ODT it's bold, in all other cases it is left unchanged."
   (when (string= desc (format "bbdb:%s" path))
     (setq desc path))
   (cond
    ((eq format 'html) (format "<i>%s</i>" desc))
    ((eq format 'latex) (format "\\textit{%s}" desc))
    ((eq format 'odt) (format "<text:span 
text:style-name=\"Bold\">%s</text:span>" desc))
    (t desc)))

Now, when I export this:

    Here's my own address (bbdb:Moe).

...the ODT document does not contain the expected:

    Here's my own address (<text:span 
text:style-name=\"Bold\">Moe</text:span>).

...instead, it contains the formatting intended for HTML:

    Here's my own address (<i>Moe</i>).

...which, of course, displays as:

    Here's my own address ().


Yours,
Christian

             reply	other threads:[~2011-11-12 19:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-12 19:33 Christian Moe [this message]
2011-11-12 21:24 ` [ODT] [BUG?] Custom links are formatted as for html Jambunathan K
2011-11-12 22:28   ` 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=4EBECA09.3030301@christianmoe.com \
    --to=mail@christianmoe.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=kjambunathan@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).