emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Ex


From: Rasmus
Subject: Re: [O] Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export.
Date: Tue, 01 Aug 2017 11:51:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Kaushal Modi <address@hidden> writes:

> This patch fixes this:
>
> From e57e9e798dd1a54cae7a633fc67e2f825b967eea Mon Sep 17 00:00:00 2001
> From: Kaushal Modi <address@hidden>
> Date: Mon, 31 Jul 2017 14:30:40 -0400
> Subject: [PATCH] Respect :with-title in ox-html
>
> * lisp/ox-html.el (org-html--build-meta-info): Do not insert <title>
>   tag in HTML export if :with-title property is nil.  Example: by
>   setting #+OPTIONS: title:nil
>
> Reported by: Ian <address@hidden>
> ---
>  lisp/ox-html.el | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/ox-html.el b/lisp/ox-html.el
> index aeb38ebc10..08381d0c19 100644
> --- a/lisp/ox-html.el
> +++ b/lisp/ox-html.el
> @@ -1812,7 +1812,8 @@ INFO is a plist used as a communication channel."
>         viewport-options ", "))
>        info)
>       "\n")))
> -     (format "<title>%s</title>\n" title)
> +     (when (plist-get info :with-title)
> +       (format "<title>%s</title>\n" title))
>       (org-html-close-tag "meta" "name=\"generator\" content=\"Org mode\""
> info)
>       "\n"
>       (and (org-string-nw-p author)

That is wrong IMO.  Title is mandatory in at least HTML{4,5}.

    https://www.w3schools.com/tags/tag_title.asp

AFAIR Org already allows invalid HTML document to be produced when the
TITLE is empty, as it’s translated into an empty quote.

The right approach IMO is not printing the h1-title block, as in the
attached patch.

(In general generating the title block should be moved to something like
‘org-html-preamble-format’, though it probably shouldn’t depend on the
language of the document...)

Rasmus

-- 
Er du tosset for noge' lårt!
>From dace1586373df27863934675967eef8c56747a82 Mon Sep 17 00:00:00 2001
From: Rasmus <address@hidden>
Date: Tue, 1 Aug 2017 11:32:44 +0200
Subject: [PATCH] ox-html: Respect the "title" option

* lisp/ox-html.el (org-html-template): Respect :with-title.

Reported-by: address@hidden
<http://permalink.gmane.org/gmane.emacs.orgmode/114942>
---
 lisp/ox-html.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 06dee3af6..43e4ef8d4 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2068,7 +2068,8 @@ holding export options."
      (format "<%s id=\"%s\">\n" (nth 1 div) (nth 2 div)))
    ;; Document title.
    (when (plist-get info :with-title)
-     (let ((title (plist-get info :title))
+     (let ((title (and (plist-get info :with-title)
+                      (plist-get info :title)))
           (subtitle (plist-get info :subtitle))
           (html5-fancy (org-html--html5-fancy-p info)))
        (when title
-- 
2.13.3


reply via email to

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