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: Kaushal Modi
Subject: Re: [O] Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export.
Date: Tue, 01 Aug 2017 19:41:15 +0000

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 <address@hidden> wrote:
Yes, but that’s a feature.  It’s 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’s 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
      "\"" "&quot;" (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 "&lrm;")) 
  (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-page#comment67991763_23558385

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


--

Kaushal Modi


reply via email to

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