emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug: html-postamble string does not allow space [9.4.4 (release_9.4.


From: Ihor Radchenko
Subject: Re: Bug: html-postamble string does not allow space [9.4.4 (release_9.4.4 @ /usr/local/share/emacs/27.2/lisp/org/)]
Date: Wed, 02 Nov 2022 04:35:16 +0000

Tim Cross <theophilusx@gmail.com> writes:

>>> What probably needs clarifying is
>>>
>>> 1. mention the string option in the manual
>>
>> It is documented in the manual: 13.9.4 HTML preamble and postamble
>>
>
> You snipped out the relevant paragraph I copied from the manual. If you
> look at it, you will see that it does not mention string as an option
> for org-html-postamble.

I see. I tried to clarify similarities and differences between pre- and
postamble in the manual. See the attached.

> Furthermore, the previous paragraph, which talks
> about org-html-preamble, which does mention string, states that if the
> string matches the name of a function, it will be called 9and expected
> to return a string).

That's wrong on the manual part.  `org-html-preamble' can be set to a
function.  When it is set to string, the string is only treated as a
format string.  No function names.  See the attached patches.

> This is not mentioned at all in the doc string for
> org-html-postamble.

Fixed in the attached.

> Therefore, I still think there is inconsistency between what the doc
> string of the variable states and what the manual states. There is no
> mention of function matching against strings in the cod string of the
> variable. There is no mention of string as an option in the paragraph
> referring to org-html-postamble in the manual. 

I hope I clarified the actual situation in the attached patches. Also, I
fixed the actual code allowing org-html-preamble to be set to 'auto (the
same code is used to format preamble and postamble). It does not make
sense.

>>> 2. If spaces are not allowed in the string, clearly document
>>> that. Currently, the doc string just says that if set to a string, use
>>> that string as the postamble, which I think implies spaces are OK. 
>>
>> They are allowed. It is just #+OPTIONS keyword that does not allow
>> strings as values. I have no idea why.
>
> This is all an aside to the actual bug, so please don't miss that
> (unless it has been fixed) i.e. a org-html-postamble string with a space
> in it does not work.

I am confused here.

The original bug talked specifically about situation like
#+options: html-postamble:"test with spaces"

Are you saying that you cannot have spaces in org-html-postamble
variable? If yes, could you please provide a reproducer?

>From fecd0a1af6eba4099e31295fc3e00b003f538d45 Mon Sep 17 00:00:00 2001
Message-Id: 
<fecd0a1af6eba4099e31295fc3e00b003f538d45.1667363392.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Wed, 2 Nov 2022 12:21:01 +0800
Subject: [PATCH 1/3] ox-html: Do not allow `org-html-preamble' to be 'auto

* lisp/ox-html.el (org-html--build-pre/postamble): Avoid building
date/author/email info line when `org-html-preamble' is set to
'auto.  This is only meaningful in `org-html-postamble'.
---
 lisp/ox-html.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index cad06aebf..36fcd536c 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1993,7 +1993,7 @@ (defun org-html--build-pre/postamble (type info)
             (if (functionp section) (funcall section info)
               (cond
                ((stringp section) (format-spec section spec))
-               ((eq section 'auto)
+               ((and (eq section 'auto) (eq type 'postamble))
                 (let ((date (cdr (assq ?d spec)))
                       (author (cdr (assq ?a spec)))
                       (email (cdr (assq ?e spec)))
-- 
2.35.1

>From 93cff0b3849c97300d979d3f95fcc5eb2a6b917c Mon Sep 17 00:00:00 2001
Message-Id: 
<93cff0b3849c97300d979d3f95fcc5eb2a6b917c.1667363392.git.yantar92@posteo.net>
In-Reply-To: 
<fecd0a1af6eba4099e31295fc3e00b003f538d45.1667363392.git.yantar92@posteo.net>
References: 
<fecd0a1af6eba4099e31295fc3e00b003f538d45.1667363392.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Wed, 2 Nov 2022 12:22:36 +0800
Subject: [PATCH 2/3] org-manual: Clarify similarities and differences between
 HTML pre/postamble

* doc/org-manual.org (HTML preamble and postamble): Clarify that
`org-html-postamble' can take the same values with
`org-html-preamble'.  Highlight, that `org-html-postamble' can also be
set to `auto'.

Reported-by: Tim Cross <theophilusx@gmail.com>
Link: https://orgmode.org/list/86wn8gbvk0.fsf@gmail.com
---
 doc/org-manual.org | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index dc2fc57cd..f07466dff 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -13027,17 +13027,17 @@ *** HTML preamble and postamble
 ~org-html-preamble-format~ for the format string.
 
 Set ~org-html-preamble~ to a string to override the default format
-string.  If the string is a function, the HTML exporter expects the
-function to return a string upon execution.  The HTML exporter inserts
-this string in the preamble.  The HTML exporter does not insert
-a preamble if ~org-html-preamble~ is set ~nil~.
-
-The default value for ~org-html-postamble~ is ~auto~, which makes the
-HTML exporter build a postamble from looking up author's name, email
-address, creator's name, and date.  Set ~org-html-postamble~ to ~t~ to
-insert the postamble in the format specified in the
-~org-html-postamble-format~ variable.  The HTML exporter does not
-insert a postamble if ~org-html-postamble~ is set to ~nil~.
+string.  If set to a function, the HTML exporter expects the function
+to return a string upon execution.  The HTML exporter inserts this
+string in the preamble.  The HTML exporter does not insert a preamble
+if ~org-html-preamble~ is set ~nil~.
+
+The above also applies to ~org-html-postamble~ and
+~org-html-postamble-format~.  In addition, ~org-html-postamble~ can be
+set to ~auto~ (its default value), which makes the HTML exporter build
+a postamble from looking up author's name, email address, creator's
+name, and date.
+
 
 *** Quoting HTML tags
 :PROPERTIES:
-- 
2.35.1

>From a87629f416f9a06099f6ce78aeeffb9a4233e5c1 Mon Sep 17 00:00:00 2001
Message-Id: 
<a87629f416f9a06099f6ce78aeeffb9a4233e5c1.1667363392.git.yantar92@posteo.net>
In-Reply-To: 
<fecd0a1af6eba4099e31295fc3e00b003f538d45.1667363392.git.yantar92@posteo.net>
References: 
<fecd0a1af6eba4099e31295fc3e00b003f538d45.1667363392.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Wed, 2 Nov 2022 12:28:52 +0800
Subject: [PATCH 3/3] org-html-postamble: Clarify that string value is format
 string

* lisp/ox-html.el (org-html-postamble): Clarify that string value of
the variable is not inserted verbatim, but used as format string.

Reported-by: Tim Cross <theophilusx@gmail.com>
Link: https://orgmode.org/list/86wn8gbvk0.fsf@gmail.com
---
 lisp/ox-html.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 36fcd536c..81f192d46 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1276,9 +1276,11 @@ (defcustom org-html-postamble 'auto
 
 When set to `auto', check against the
 `org-export-with-author/email/creator/date' variables to set the
-content of the postamble.  When set to a string, use this string
-as the postamble.  When t, insert a string as defined by the
-formatting string in `org-html-postamble-format'.
+content of the postamble.  When t, insert a string as defined by the
+formatting string in `org-html-postamble-format'.  When set to a
+string, use this formatting string instead (see
+`org-html-postamble-format' for an example of such a formatting
+string).
 
 When set to a function, apply this function and insert the
 returned string.  The function takes the property list of export
-- 
2.35.1

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]