From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export. Date: Tue, 01 Aug 2017 19:41:15 +0000 Message-ID: References: <71359491574f233bd37d0804042fb701@wilkesley.net> <87ini7d3aj.fsf@gmx.us> <87efsvcz9m.fsf@gmx.us> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="f403045fb91437b90e0555b655c4" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcd2o-0001hZ-KP for emacs-orgmode@gnu.org; Tue, 01 Aug 2017 15:41:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcd2n-0007t6-Db for emacs-orgmode@gnu.org; Tue, 01 Aug 2017 15:41:30 -0400 Received: from mail-lf0-x22a.google.com ([2a00:1450:4010:c07::22a]:34151) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcd2n-0007qs-1p for emacs-orgmode@gnu.org; Tue, 01 Aug 2017 15:41:29 -0400 Received: by mail-lf0-x22a.google.com with SMTP id g25so11317171lfh.1 for ; Tue, 01 Aug 2017 12:41:27 -0700 (PDT) In-Reply-To: <87efsvcz9m.fsf@gmx.us> 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: Rasmus Cc: emacs-orgmode@gnu.org --f403045fb91437b90e0555b655c4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Rasmus, Your patch to fix printing of h1 title when :with-title is nil looks good. More comments below. On Tue, Aug 1, 2017 at 7:18 AM Rasmus wrote: > Yes, but that=E2=80=99s a feature. It=E2=80=99s how ox-{latex,odt} works= as well (via > hyperref). > OK, I agree that the title being made blank not be tied with `:with-title`. > > So I was going to suggest to set title tag to empty string "" or > something > > generic like "HTML". I don't think I would use the title:nil option. > > You can do this by setting title to an empty quote and Org will export it= , > but you produce invalid HTML. It=E2=80=99s actually a bug in ox-html IMO= . > Here is my attempt to fix it (below is a whitespace ignored diff): diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 43e4ef8d48..25a41e1dc4 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -1812,11 +1812,14 @@ INFO is a plist used as a communication channel." (defun org-html--build-meta-info (info) "Return meta tags for exported document. INFO is a plist used as a communication channel." - (let ((protect-string + (let* ((protect-string (lambda (str) (replace-regexp-in-string "\"" """ (org-html-encode-plain-text str)))) (title (org-export-data (plist-get info :title) info)) + ;; Set title to an invisible character instead of leaving it + ;; empty, which is invalid. + (title (if (org-string-nw-p title) title "‎")) (author (and (plist-get info :with-author) (let ((auth (plist-get info :author))) (and auth Credit: https://stackoverflow.com/questions/23556255/how-can-i-have-a-blank-title-p= age#comment67991763_23558385 With above, a "blank" title will also result in a valid HTML, correct? --=20 Kaushal Modi --f403045fb91437b90e0555b655c4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Rasmus,

<= /div>
Your patch to fix printing of h1 title when :with-title is nil lo= oks good.

More comments below.

<= /div>
On Tue, Aug 1, 2017 at 7:18 AM Rasmus <rasmus@gmx.us> wrote:
Yes, but that=E2=80=99s a feature.=C2=A0 It=E2=80=99s how o= x-{latex,odt} works as well (via
hyperref).

OK, I agree that the title b= eing made blank not be tied with `:with-title`.
=C2=A0
> So I was going to suggest to set title tag t= o empty string "" or something
> generic like "HTML". I don't think I would use the title= :nil option.

You can do this by setting title to an empty quote and Org will export it,<= br> but you produce invalid HTML.=C2=A0 It=E2=80=99s actually a bug in ox-html = IMO.

Here is my attempt to fix it (belo= w is a whitespace ignored diff):

diff --git a= /lisp/ox-html.el b/lisp/ox-html.el
index 43e4ef8d48..25a41e1dc4 1= 00644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
=
@@ -1812,11 +1812,14 @@ INFO is a plist used as a communication channe= l."
=C2=A0(defun org-html--build-meta-info (info)
= =C2=A0 =C2=A0"Return meta tags for exported document.
=C2=A0= INFO is a plist used as a communication channel."
- =C2=A0(l= et ((protect-string
+ =C2=A0(let* ((protect-string
=C2= =A0 =C2=A0(lambda (str)
= =C2=A0 =C2=A0 =C2=A0(replace-regexp= -in-string
=C2=A0 =C2=A0 = =C2=A0 "\"" "&quot;" (org-html-encode-plain-te= xt str))))
=C2=A0 (title = (org-export-data (plist-get info :title) info))
+ ;; Set title to an invisible character instead of = leaving it
+ ;; empty, wh= ich is invalid.
+ (title = (if (org-string-nw-p title) title "&lrm;"))=C2=A0
= =C2=A0 (author (and (plist-get info= :with-author)
=C2=A0 = =C2=A0 =C2=A0 =C2=A0(let ((auth (plist-get info :author)))
=C2=A0= (and auth


With above, a "blank"= ; title will also result in a valid HTML, correct?


--

Kaushal Modi

--f403045fb91437b90e0555b655c4--