all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christian Moe <mail@christianmoe.com>
To: emacs-orgmode@gnu.org
Subject: [BUG][ODT] ODT_STYLES_FILE not read as a list
Date: Tue, 30 Oct 2018 21:47:19 +0100	[thread overview]
Message-ID: <8736snjh60.fsf@christianmoe.com> (raw)

Hi,

It seems the ODT exporter currently fails to read the ODT_STYLES_FILE
option as a list, as in this example from the manual
([[info:org#Applying custom styles]]):

  #+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png"))

This is needed if you want a complex style with e.g. an image in the
header.

Exporting this causes an "Invalid specification of styles.xml file"
error on my recent ELPA version. The problem seems to be that the option
is treated as a string and never tested to see if it contains a list.

To reproduce the problem, place the attached documents
odt-styles-test.org and odt-test-styles.odt in the same directory, then
export odt-styles-test.org to ODT. The result should have a unicorn in
the letterhead.

The below quick-and-dirty patch seems to fix it, but I'm sure there's a
better approach.

*** /home/cm/.emacs.d/elpa/org-20180924/ox-odt.el	2018-09-27 13:38:07.644922989 +0200
--- /home/cm/Downloads/ox-odt.el	2018-10-30 21:18:44.827975243 +0100
***************
*** 1360,1365 ****
--- 1360,1368 ----
    (let* ((styles-file (plist-get info :odt-styles-file))
  	 (styles-file (and (org-string-nw-p styles-file)
  			   (org-trim styles-file)))
+ 	 ;; Try reading it as a list
+ 	 (styles-expr (car (read-from-string styles-file)))
+ 	 (styles-file (if (listp styles-expr) styles-expr styles-file)
  	 ;; Non-availability of styles.xml is not a critical
  	 ;; error. For now, throw an error.
  	 (styles-file (or styles-file

             reply	other threads:[~2018-10-30 20:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-30 20:47 Christian Moe [this message]
2018-10-30 20:49 ` [BUG][ODT] ODT_STYLES_FILE not read as a list Christian Moe
2018-11-04 22:05 ` Nicolas Goaziou
2018-11-05  8:49   ` Christian Moe
2018-11-06 15:18     ` L.C. Karssen
2018-11-06 15:35       ` Christian Moe
2018-11-06 16:15         ` L.C. Karssen
2018-11-07  8:28           ` Christian Moe
2018-11-07 15:32             ` L.C. Karssen
2018-11-10  8:16               ` Nicolas Goaziou
2018-11-19 17:21                 ` L.C. Karssen
2018-11-19 22:58                   ` Nicolas Goaziou

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

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

  git send-email \
    --in-reply-to=8736snjh60.fsf@christianmoe.com \
    --to=mail@christianmoe.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.