From mboxrd@z Thu Jan 1 00:00:00 1970 From: "L.C. Karssen" Subject: Re: [BUG][ODT] ODT_STYLES_FILE not read as a list Date: Wed, 7 Nov 2018 16:32:19 +0100 Message-ID: References: <8736snjh60.fsf@christianmoe.com> <87r2g08pn8.fsf@nicolasgoaziou.fr> <87a7mnewov.fsf@christianmoe.com> <1fb5458b-43b7-e414-ce73-08d011339ccb@karssen.org> <87r2fyxlpl.fsf@christianmoe.com> <2fbfc24e-c356-831b-0e41-cca5a79de9c3@karssen.org> <87pnvhxpdm.fsf@christianmoe.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2XVvz1OOqbDLkxRXbxTRfr0Hv1gVIJltf" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKPp1-00017H-1x for emacs-orgmode@gnu.org; Wed, 07 Nov 2018 10:32:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gKPow-0005YC-7A for emacs-orgmode@gnu.org; Wed, 07 Nov 2018 10:32:47 -0500 Received: from lb2-smtp-cloud8.xs4all.net ([194.109.24.25]:56255) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gKPou-0005H2-6u for emacs-orgmode@gnu.org; Wed, 07 Nov 2018 10:32:42 -0500 In-Reply-To: <87pnvhxpdm.fsf@christianmoe.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" To: emacs-orgmode@gnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --2XVvz1OOqbDLkxRXbxTRfr0Hv1gVIJltf Content-Type: multipart/mixed; boundary="yEdEXkVlF85Yq6Ry4z7WYjlM7ysYKE0wQ"; protected-headers="v1" From: "L.C. Karssen" To: emacs-orgmode@gnu.org Message-ID: Subject: Re: [O] [BUG][ODT] ODT_STYLES_FILE not read as a list References: <8736snjh60.fsf@christianmoe.com> <87r2g08pn8.fsf@nicolasgoaziou.fr> <87a7mnewov.fsf@christianmoe.com> <1fb5458b-43b7-e414-ce73-08d011339ccb@karssen.org> <87r2fyxlpl.fsf@christianmoe.com> <2fbfc24e-c356-831b-0e41-cca5a79de9c3@karssen.org> <87pnvhxpdm.fsf@christianmoe.com> In-Reply-To: <87pnvhxpdm.fsf@christianmoe.com> --yEdEXkVlF85Yq6Ry4z7WYjlM7ysYKE0wQ Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: quoted-printable Thanks for digging into this Christian. My lisp skills are quite undeveloped, so I can't really comment on the code. I had a look at the manual and I think we should go for a solution that is consistent for #+ keywords that have a filename argument like #+INCLUDE:, #+SETUPFILE and #+TEXINFO_FILENAME. Taking the risk that the manual is lagging behind the actual code, I see the following: #+ODT_STYLES_FILE: uses quotes #+INCLUDE: uses quotes #+TEXINFO_FILENAME: doesn't use quotes [1] #+SETUPFILE: no example in the manual #+HTML_INCLUDE_STYLE: no example in the manual, not sure if this requires a file or CSS code Another point to consider: would requiring quoted filenames make life easier for people using spaces etc. in their filenames? In that case I'd vote for quotes. Best, Lennart. [1] https://orgmode.org/org.html#A-Texinfo-example On 07-11-18 09:28, Christian Moe wrote: >=20 > Nicolas, Lennart, cc: Charles Celerier, >=20 > Below, Lennart points out another issue with ODT_STYLES_FILE, a silent > change in syntax not reflected in the manual: quotation marks are no > longer needed around simple file paths. >=20 > I think this change was introduced by the below commit, which stopped > reading the string as a Lisp expression, and therefore at the same time= > broke the option of providing a list for #+ODT_STYLES_FILE. My patch > last week fixed the list problem, but left the other change > intact. (Sorry for not doing the research.) >=20 > We could either update the manual and announce the syntax change, or > revert ox-odt-template to before the below patch to bring the code back= > in conformity with the manual. I don't have a strong opinion one way or= > the other. I like the change (never liked those quotation marks), but > it's backwards-incompatible, and the old code looks cleaner than my fix= =2E >=20 > Yours, > Christian >=20 >=20 > commit 30498ef932bc35c26e3e58278f4987a67480b446 > Author: Charles Celerier > Date: Sat Jul 28 17:09:16 2018 -0400 >=20 > ox-odt: Fix `org-odt-template' styles file retrieval >=20 > * lisp/ox-odt.el (org-odt-template): Fix `org-odt-template' styles > file retrieval. >=20 > TINYCHANGE >=20 > Signed-off-by: Charles Celerier >=20 > diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el > index a1145a9..74d811d 100644 > --- a/lisp/ox-odt.el > +++ b/lisp/ox-odt.el > @@ -1359,11 +1359,10 @@ original parsed data. INFO is a plist holding = export options." > ;; Write styles file. > (let* ((styles-file (plist-get info :odt-styles-file)) > (styles-file (and (org-string-nw-p styles-file) > - (read (org-trim styles-file)))) > + (org-trim styles-file))) > ;; Non-availability of styles.xml is not a critical > ;; error. For now, throw an error. > (styles-file (or styles-file > - (plist-get info :odt-styles-file) > (expand-file-name "OrgOdtStyles.xml" > org-odt-styles-dir) > (error "org-odt: Missing styles file?")))) >=20 >=20 >=20 >=20 > L.C. Karssen writes: >=20 >> On 06-11-18 16:35, Christian Moe wrote: >>> >>> I believe the need to use quotation marks around the style file name = was >>> removed at some point >> >> I didn't know that. I had a quick look at the changes to ox-odt.el for= >> the last few months, but it doesn't seem to be mentioned in any of the= >> commit messages. Or was this a more global change? >> >> Does this also count for the regular #+INCLUDE: statement? I just test= ed >> it and for #+INCLUDE: it seems to work both with and without quotes >> (although the manual uses quotes). >> >> >> Best, >> >> Lennart. >> >>> , and the manual is out of date. Instead of >>> >>> #+ODT_STYLES_FILE: "template.ott" >>> >>> the manual ought now to read: >>> >>> #+ODT_STYLES_FILE: template.ott >>> >>> Yours, >>> Christian >>> >>> L.C. Karssen writes: >>> >>>> Hi list, >>>> >>>> Not sure if this is related (or fixed with the aforementioned patch)= >>>> because I'm not using a list for the ODT style file. >>>> >>>> Today, after upgrading from Org 9.1.13 (actually installed from melp= a on >>>> 20180625) to melpa version 20181105 exporting to ODT stopped working= =2E In >>>> my org file the style file name was enclosed in double quotes (as >>>> specified in the manual [1]): >>>> >>>> #+ODT_STYLES_FILE: "template.ott" >>>> >>>> The error message is: >>>> >>>> OpenDocument export failed: Invalid specification of styles.xml file= : >>>> "\"template.ott\"" >>>> >>>> Removing the quotes fixes the export to ODT. >>>> >>>> >>>> Best regards, >>>> >>>> Lennart. >>>> >>>> [1] https://orgmode.org/org.html#Applying-custom-styles >>>> >>>> >>>> On 05-11-18 09:49, Christian Moe wrote: >>>>> >>>>> Thanks, Nicolas! >>>>> >>>>> I'll test on my end when it shows up in ELPA. >>>>> >>>>> Yours, >>>>> Christian >>>>> >>>>> Nicolas Goaziou writes: >>>>> >>>>>> Hello, >>>>>> >>>>>> Christian Moe writes: >>>>>> >>>>>>> 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/hd= r.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 fil= e" >>>>>>> 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 l= ist. >>>>>>> >>>>>>> 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 unico= rn in >>>>>>> the letterhead. >>>>>>> >>>>>>> The below quick-and-dirty patch seems to fix it, but I'm sure the= re's a >>>>>>> better approach. >>>>>> >>>>>> Thank you. I applied your patch with an additional check: the valu= e should >>>>>> be enclosed within round brackets. >>>>>> >>>>>> Regards, >>>>> >>>>> >=20 --=20 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* L.C. Karssen 's-Hertogenbosch The Netherlands lennart@karssen.org http://blog.karssen.org GPG key ID: A88F554A -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- --yEdEXkVlF85Yq6Ry4z7WYjlM7ysYKE0wQ-- --2XVvz1OOqbDLkxRXbxTRfr0Hv1gVIJltf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEAREIAB0WIQQyBENSov4Y8H9uObIgAxQL2pzVCQUCW+MFgwAKCRAgAxQL2pzV Cfg/AP4/w5oZAex/zLOKAZ+ZwhuIxMSf4etPLi4KPa8QBM3MvAD/QL8SNUL/JNIX F1UoID53esMJySxufuEMPXq4FdkdE4g= =FzaR -----END PGP SIGNATURE----- --2XVvz1OOqbDLkxRXbxTRfr0Hv1gVIJltf--