From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Moe Subject: [BUG][ODT] ODT_STYLES_FILE not read as a list Date: Tue, 30 Oct 2018 21:47:19 +0100 Message-ID: <8736snjh60.fsf@christianmoe.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHavg-0000c5-1K for emacs-orgmode@gnu.org; Tue, 30 Oct 2018 16:48:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHavc-0006Et-0l for emacs-orgmode@gnu.org; Tue, 30 Oct 2018 16:47:59 -0400 Received: from mailer-211-194.hitrost.net ([91.185.211.194]:43041) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gHava-0006CG-A4 for emacs-orgmode@gnu.org; Tue, 30 Oct 2018 16:47:55 -0400 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" To: emacs-orgmode@gnu.org 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