emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Tim Cross <theophilusx@gmail.com>
Cc: Ihor Radchenko <yantar92@gmail.com>,  emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <87wn8ekm7v.fsf@localhost> (raw)
In-Reply-To: <86wn8gbvk0.fsf@gmail.com>

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

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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-html-Do-not-allow-org-html-preamble-to-be-auto.patch --]
[-- Type: text/x-patch, Size: 1096 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-org-manual-Clarify-similarities-and-differences-betw.patch --]
[-- Type: text/x-patch, Size: 2483 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-org-html-postamble-Clarify-that-string-value-is-form.patch --]
[-- Type: text/x-patch, Size: 1701 bytes --]

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


[-- Attachment #5: Type: text/plain, Size: 224 bytes --]


-- 
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	other threads:[~2022-11-02  4:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-10 16:35 Bug: html-postamble string does not allow space [9.4.4 (release_9.4.4 @ /usr/local/share/emacs/27.2/lisp/org/)] Pierre Balayé
2022-06-13  2:45 ` Tim Cross
2022-10-07  8:05   ` Ihor Radchenko
2022-10-30 22:02     ` Tim Cross
2022-10-31  1:22       ` Ihor Radchenko
2022-10-31  1:54         ` Tim Cross
2022-11-02  4:35           ` Ihor Radchenko [this message]
2022-11-16  4:50             ` Ihor Radchenko
2022-11-16 21:49             ` Tim Cross
2022-11-17  5:49               ` Ihor Radchenko
2022-11-17  4:56 ` Ihor Radchenko

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=87wn8ekm7v.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=theophilusx@gmail.com \
    --cc=yantar92@gmail.com \
    /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 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).