emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG][ODT] ODT_STYLES_FILE not read as a list
@ 2018-10-30 20:47 Christian Moe
  2018-10-30 20:49 ` Christian Moe
  2018-11-04 22:05 ` Nicolas Goaziou
  0 siblings, 2 replies; 12+ messages in thread
From: Christian Moe @ 2018-10-30 20:47 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG][ODT] ODT_STYLES_FILE not read as a list
  2018-10-30 20:47 [BUG][ODT] ODT_STYLES_FILE not read as a list Christian Moe
@ 2018-10-30 20:49 ` Christian Moe
  2018-11-04 22:05 ` Nicolas Goaziou
  1 sibling, 0 replies; 12+ messages in thread
From: Christian Moe @ 2018-10-30 20:49 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 42 bytes --]


Sorry, forgot to attach the test files.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: odt-styles-test.org --]
[-- Type: text/x-org, Size: 606 bytes --]

#+title: ODT styles test
#+ODT_STYLES_FILE: ("odt-test-styles.odt" ("styles.xml" "Pictures/10000201000000A2000000B0A7D655E3F0A97ECF.png"))



Place this Org file in the same directory as the
accompanying file odt-test-styles.odt and export it to ODT.

Expected result: the exported document has a picture of the Org
unicorn in the header.

The ODT_STYLES_FILE option is set correctly according to
[[info:org#Applying%20custom%20styles][info:org#Applying custom styles]]. It references another ODT document
providing the custom styles to apply to this document, including an
image to be used in the header.

[-- Attachment #3: odt-test-styles.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 25920 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG][ODT] ODT_STYLES_FILE not read as a list
  2018-10-30 20:47 [BUG][ODT] ODT_STYLES_FILE not read as a list Christian Moe
  2018-10-30 20:49 ` Christian Moe
@ 2018-11-04 22:05 ` Nicolas Goaziou
  2018-11-05  8:49   ` Christian Moe
  1 sibling, 1 reply; 12+ messages in thread
From: Nicolas Goaziou @ 2018-11-04 22:05 UTC (permalink / raw)
  To: Christian Moe; +Cc: emacs-orgmode

Hello,

Christian Moe <mail@christianmoe.com> 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/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.

Thank you. I applied your patch with an additional check: the value should
be enclosed within round brackets.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG][ODT] ODT_STYLES_FILE not read as a list
  2018-11-04 22:05 ` Nicolas Goaziou
@ 2018-11-05  8:49   ` Christian Moe
  2018-11-06 15:18     ` L.C. Karssen
  0 siblings, 1 reply; 12+ messages in thread
From: Christian Moe @ 2018-11-05  8:49 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Christian Moe


Thanks, Nicolas!

I'll test on my end when it shows up in ELPA.

Yours,
Christian

Nicolas Goaziou writes:

> Hello,
>
> Christian Moe <mail@christianmoe.com> 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/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.
>
> Thank you. I applied your patch with an additional check: the value should
> be enclosed within round brackets.
>
> Regards,

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG][ODT] ODT_STYLES_FILE not read as a list
  2018-11-05  8:49   ` Christian Moe
@ 2018-11-06 15:18     ` L.C. Karssen
  2018-11-06 15:35       ` Christian Moe
  0 siblings, 1 reply; 12+ messages in thread
From: L.C. Karssen @ 2018-11-06 15:18 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2234 bytes --]

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 melpa on
20180625) to melpa version 20181105 exporting to ODT stopped working. 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 <mail@christianmoe.com> 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/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.
>>
>> Thank you. I applied your patch with an additional check: the value should
>> be enclosed within round brackets.
>>
>> Regards,
> 
> 

-- 
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
L.C. Karssen
's-Hertogenbosch
The Netherlands

lennart@karssen.org
http://blog.karssen.org
GPG key ID: A88F554A
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG][ODT] ODT_STYLES_FILE not read as a list
  2018-11-06 15:18     ` L.C. Karssen
@ 2018-11-06 15:35       ` Christian Moe
  2018-11-06 16:15         ` L.C. Karssen
  0 siblings, 1 reply; 12+ messages in thread
From: Christian Moe @ 2018-11-06 15:35 UTC (permalink / raw)
  To: L.C. Karssen; +Cc: emacs-orgmode


I believe the need to use quotation marks around the style file name was
removed at some point, 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 melpa on
> 20180625) to melpa version 20181105 exporting to ODT stopped working. 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 <mail@christianmoe.com> 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/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.
>>>
>>> Thank you. I applied your patch with an additional check: the value should
>>> be enclosed within round brackets.
>>>
>>> Regards,
>>
>>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG][ODT] ODT_STYLES_FILE not read as a list
  2018-11-06 15:35       ` Christian Moe
@ 2018-11-06 16:15         ` L.C. Karssen
  2018-11-07  8:28           ` Christian Moe
  0 siblings, 1 reply; 12+ messages in thread
From: L.C. Karssen @ 2018-11-06 16:15 UTC (permalink / raw)
  To: Christian Moe; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 3158 bytes --]


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 tested
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 melpa on
>> 20180625) to melpa version 20181105 exporting to ODT stopped working. 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 <mail@christianmoe.com> 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/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.
>>>>
>>>> Thank you. I applied your patch with an additional check: the value should
>>>> be enclosed within round brackets.
>>>>
>>>> Regards,
>>>
>>>

-- 
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
L.C. Karssen
's-Hertogenbosch
The Netherlands

lennart@karssen.org
http://blog.karssen.org
GPG key ID: A88F554A
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG][ODT] ODT_STYLES_FILE not read as a list
  2018-11-06 16:15         ` L.C. Karssen
@ 2018-11-07  8:28           ` Christian Moe
  2018-11-07 15:32             ` L.C. Karssen
  0 siblings, 1 reply; 12+ messages in thread
From: Christian Moe @ 2018-11-07  8:28 UTC (permalink / raw)
  To: L.C. Karssen, Nicolas Goaziou, Charles Celerier
  Cc: emacs-orgmode, Christian Moe


Nicolas, Lennart, cc: Charles Celerier,

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.

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.)

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.

Yours,
Christian


commit 30498ef932bc35c26e3e58278f4987a67480b446
Author: Charles Celerier <chckyn@gmail.com>
Date:   Sat Jul 28 17:09:16 2018 -0400

    ox-odt: Fix `org-odt-template' styles file retrieval

    * lisp/ox-odt.el (org-odt-template): Fix `org-odt-template' styles
      file retrieval.

    TINYCHANGE

    Signed-off-by: Charles Celerier <chckyn@gmail.com>

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?"))))




L.C. Karssen writes:

> 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 tested
> 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 melpa on
>>> 20180625) to melpa version 20181105 exporting to ODT stopped working. 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 <mail@christianmoe.com> 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/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.
>>>>>
>>>>> Thank you. I applied your patch with an additional check: the value should
>>>>> be enclosed within round brackets.
>>>>>
>>>>> Regards,
>>>>
>>>>

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [BUG][ODT] ODT_STYLES_FILE not read as a list
  2018-11-07  8:28           ` Christian Moe
@ 2018-11-07 15:32             ` L.C. Karssen
  2018-11-10  8:16               ` Nicolas Goaziou
  0 siblings, 1 reply; 12+ messages in thread
From: L.C. Karssen @ 2018-11-07 15:32 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 6638 bytes --]

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:
> 
> Nicolas, Lennart, cc: Charles Celerier,
> 
> 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.
> 
> 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.)
> 
> 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.
> 
> Yours,
> Christian
> 
> 
> commit 30498ef932bc35c26e3e58278f4987a67480b446
> Author: Charles Celerier <chckyn@gmail.com>
> Date:   Sat Jul 28 17:09:16 2018 -0400
> 
>     ox-odt: Fix `org-odt-template' styles file retrieval
> 
>     * lisp/ox-odt.el (org-odt-template): Fix `org-odt-template' styles
>       file retrieval.
> 
>     TINYCHANGE
> 
>     Signed-off-by: Charles Celerier <chckyn@gmail.com>
> 
> 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?"))))
> 
> 
> 
> 
> L.C. Karssen writes:
> 
>> 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 tested
>> 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 melpa on
>>>> 20180625) to melpa version 20181105 exporting to ODT stopped working. 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 <mail@christianmoe.com> 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/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.
>>>>>>
>>>>>> Thank you. I applied your patch with an additional check: the value should
>>>>>> be enclosed within round brackets.
>>>>>>
>>>>>> Regards,
>>>>>
>>>>>
> 

-- 
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
L.C. Karssen
's-Hertogenbosch
The Netherlands

lennart@karssen.org
http://blog.karssen.org
GPG key ID: A88F554A
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG][ODT] ODT_STYLES_FILE not read as a list
  2018-11-07 15:32             ` L.C. Karssen
@ 2018-11-10  8:16               ` Nicolas Goaziou
  2018-11-19 17:21                 ` L.C. Karssen
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Goaziou @ 2018-11-10  8:16 UTC (permalink / raw)
  To: L.C. Karssen; +Cc: emacs-orgmode

Hello,

"L.C. Karssen" <lennart@karssen.org> writes:

> 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.

Org allows both quoted and unquoted filenames. It is a bug if you spot
a location where it is not the case. I fixed TEXINFO_FILENAME.

HTML_INCLUDE_STYLE keyword doesn't exist anymore.

It doesn't matter which type the manual uses, IMO.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG][ODT] ODT_STYLES_FILE not read as a list
  2018-11-10  8:16               ` Nicolas Goaziou
@ 2018-11-19 17:21                 ` L.C. Karssen
  2018-11-19 22:58                   ` Nicolas Goaziou
  0 siblings, 1 reply; 12+ messages in thread
From: L.C. Karssen @ 2018-11-19 17:21 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1911 bytes --]

Dear Nicolas,

I saw you changed a couple of things in the ODT exporter code recently.
I installed version (9.1.14-9-g131531-elpa today to see if those commits
fixed the issue(s) discussed in this thread. However, exporting to ODT
with a quoted template file name (#+ODT_STYLES_FILE) still doesn't work.
The window is split and a new (empty) buffer is created. The following
error message appears in *Messages* (note the escaped double quotes):

OpenDocument export failed: Invalid specification of styles.xml file:
"\"my_template.ott\""

The name of the newly created buffer is identical to this message.


The export works when the style file is not enclosed in double quotes.


Best regards,

Lennart.

On 10-11-18 09:16, Nicolas Goaziou wrote:
> Hello,
> 
> "L.C. Karssen" <lennart@karssen.org> writes:
> 
>> 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.
> 
> Org allows both quoted and unquoted filenames. It is a bug if you spot
> a location where it is not the case. I fixed TEXINFO_FILENAME.
> 
> HTML_INCLUDE_STYLE keyword doesn't exist anymore.
> 
> It doesn't matter which type the manual uses, IMO.
> 
> Regards,
> 

-- 
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
L.C. Karssen
's-Hertogenbosch
The Netherlands

lennart@karssen.org
http://blog.karssen.org
GPG key ID: A88F554A
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [BUG][ODT] ODT_STYLES_FILE not read as a list
  2018-11-19 17:21                 ` L.C. Karssen
@ 2018-11-19 22:58                   ` Nicolas Goaziou
  0 siblings, 0 replies; 12+ messages in thread
From: Nicolas Goaziou @ 2018-11-19 22:58 UTC (permalink / raw)
  To: L.C. Karssen; +Cc: emacs-orgmode

Hello,

"L.C. Karssen" <lennart@karssen.org> writes:

> I saw you changed a couple of things in the ODT exporter code recently.
> I installed version (9.1.14-9-g131531-elpa today to see if those
> commits

This is not git HEAD, only the latest stable release. Could you try
development version instead?

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-11-19 22:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-30 20:47 [BUG][ODT] ODT_STYLES_FILE not read as a list Christian Moe
2018-10-30 20:49 ` 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

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).