emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export.
@ 2017-07-31 17:35 lists
  2017-07-31 18:24 ` Kaushal Modi
  0 siblings, 1 reply; 15+ messages in thread
From: lists @ 2017-07-31 17:35 UTC (permalink / raw)
  To: emacs-orgmode

I don't know if this is intended behaviour or not.

Save the following as setuop.org

#+BEGIN_SRC

:SETUP:
#+LANGUAGE:  en
#+DRAWERS: SETUP NOTES PROPERTIES
#+OPTIONS: author:nil date:nil d:nil title:nil ':t tex:t
#+STARTUP: content indent

:END:

#+END_SRC

Now include setup.org in test.org

#+BEGIN_SRC

#+SETUPFILE: ./setup.org
#+TITLE: A Three Second Route.
* A Three Second Route.
Some text.


#+END_SRC

Exporting as html result in:

#+BEGIN_SRC html

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2017-07-31 Mon 18:22 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>A Three Second Route.</title>
<meta name="generator" content="Org mode" />
#+END_SRC

Note that TITLE is exported.

Using org-master bb6e40b08655cc2f33bdf6f9

Ian.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export.
  2017-07-31 17:35 Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export lists
@ 2017-07-31 18:24 ` Kaushal Modi
  2017-07-31 18:33   ` Kaushal Modi
  0 siblings, 1 reply; 15+ messages in thread
From: Kaushal Modi @ 2017-07-31 18:24 UTC (permalink / raw)
  To: lists, emacs-orgmode

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

On Mon, Jul 31, 2017 at 1:37 PM <lists@wilkesley.net> wrote:

> I don't know if this is intended behaviour or not.
>
> Save the following as setuop.org
>
> #+BEGIN_SRC
>
> :SETUP:
> #+LANGUAGE:  en
> #+DRAWERS: SETUP NOTES PROPERTIES
> #+OPTIONS: author:nil date:nil d:nil title:nil ':t tex:t
> #+STARTUP: content indent
>
> :END:
>
> #+END_SRC
>

I haven't seen that kind of property-drawer like syntax for setupfile
before (:SETUP: .. :END:).. But looks like that's just the way you
represented in this email?


> Now include setup.org in test.org
>
> #+BEGIN_SRC
>
> #+SETUPFILE: ./setup.org
> #+TITLE: A Three Second Route.
> * A Three Second Route.
> Some text.
>
>
> #+END_SRC
>
> Exporting as html result in:
>
> #+BEGIN_SRC html
>
> <?xml version="1.0" encoding="utf-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
> <head>
> <!-- 2017-07-31 Mon 18:22 -->
> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
> <meta name="viewport" content="width=device-width, initial-scale=1" />
> <title>A Three Second Route.</title>
> <meta name="generator" content="Org mode" />
> #+END_SRC
>
> Note that TITLE is exported.
>
> Using org-master bb6e40b08655cc2f33bdf6f9
>

 I can recreate this issue when using the HTML backed, not when using the
ascii backend.

My example:

== setup.org ==
#+OPTIONS: title:nil author:nil toc:nil
=====

== example.org =====
#+SETUPFILE: ./setup.org
#+TITLE: This Title Must Not Export
* Heading 1
Some text.
=====

C-c C-e t A (ascii export to buffer) gives:

=====
1 Heading 1
===========

  Some text.
=====

C-c C-e h H (html export to buffer) gives:

=====
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2017-07-31 Mon 14:22 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>This Title Must Not Export</title>
== <snip> ==

-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 4397 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export.
  2017-07-31 18:24 ` Kaushal Modi
@ 2017-07-31 18:33   ` Kaushal Modi
  2017-08-01  8:15     ` Nicolas Goaziou
  2017-08-01  9:51     ` Rasmus
  0 siblings, 2 replies; 15+ messages in thread
From: Kaushal Modi @ 2017-07-31 18:33 UTC (permalink / raw)
  To: lists, emacs-orgmode

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

This patch fixes this:

From e57e9e798dd1a54cae7a633fc67e2f825b967eea Mon Sep 17 00:00:00 2001
From: Kaushal Modi <kaushal.modi@gmail.com>
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 <lists@wilkesley.net>
---
 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)
-- 
2.13.0


OK to commit to maint?

On Mon, Jul 31, 2017 at 2:24 PM Kaushal Modi <kaushal.modi@gmail.com> wrote:

>
> C-c C-e h H (html export to buffer) gives:
>
> =====
> <?xml version="1.0" encoding="utf-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
> <head>
> <!-- 2017-07-31 Mon 14:22 -->
> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
> <meta name="viewport" content="width=device-width, initial-scale=1" />
> <title>This Title Must Not Export</title>
> == <snip> ==
>
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 3646 bytes --]

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export.
  2017-07-31 18:33   ` Kaushal Modi
@ 2017-08-01  8:15     ` Nicolas Goaziou
  2017-08-01  9:51     ` Rasmus
  1 sibling, 0 replies; 15+ messages in thread
From: Nicolas Goaziou @ 2017-08-01  8:15 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: emacs-orgmode, lists

Hello,

Kaushal Modi <kaushal.modi@gmail.com> writes:

> From e57e9e798dd1a54cae7a633fc67e2f825b967eea Mon Sep 17 00:00:00 2001
> From: Kaushal Modi <kaushal.modi@gmail.com>
> 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

[...]

> +     (when (plist-get info :with-title)
> +       (format "<title>%s</title>\n" title))

I would use `and' instead of `when' to stress the fact that we're
interested in the return value. Otherwise, LGTM.

Thank you.

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export.
  2017-07-31 18:33   ` Kaushal Modi
  2017-08-01  8:15     ` Nicolas Goaziou
@ 2017-08-01  9:51     ` Rasmus
  2017-08-01 10:41       ` Kaushal Modi
  2017-08-01 21:58       ` Tim Cross
  1 sibling, 2 replies; 15+ messages in thread
From: Rasmus @ 2017-08-01  9:51 UTC (permalink / raw)
  To: emacs-orgmode

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

Kaushal Modi <kaushal.modi@gmail.com> writes:

> This patch fixes this:
>
> From e57e9e798dd1a54cae7a633fc67e2f825b967eea Mon Sep 17 00:00:00 2001
> From: Kaushal Modi <kaushal.modi@gmail.com>
> 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 <lists@wilkesley.net>
> ---
>  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!

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-html-Respect-the-title-option.patch --]
[-- Type: text/x-diff, Size: 971 bytes --]

From dace1586373df27863934675967eef8c56747a82 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
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: lists@wilkesley.net
<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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export.
  2017-08-01  9:51     ` Rasmus
@ 2017-08-01 10:41       ` Kaushal Modi
  2017-08-01 11:18         ` Rasmus
  2017-08-01 21:58       ` Tim Cross
  1 sibling, 1 reply; 15+ messages in thread
From: Kaushal Modi @ 2017-08-01 10:41 UTC (permalink / raw)
  To: Rasmus, emacs-org list

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

On Tue, Aug 1, 2017, 5:52 AM Rasmus <rasmus@gmx.us> wrote:

>
> That is wrong IMO.  Title is mandatory in at least HTML{4,5}.
>
>     https://www.w3schools.com/tags/tag_title.asp


Thanks, I was not aware of that.

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

With the new patch, wouldn't the title, that was not intended to be shown,
still show up in places like browser tabs and bookmarks? I have to yet try
it.

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. But if
one needs to hide the title, I think it should not leak out of the Org
document.

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

attached patch.
>

That would be fine if that prevents the title from showing up in browser
tabs, etc.

(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...)
>
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 2343 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export.
  2017-08-01 10:41       ` Kaushal Modi
@ 2017-08-01 11:18         ` Rasmus
  2017-08-01 19:41           ` Kaushal Modi
  0 siblings, 1 reply; 15+ messages in thread
From: Rasmus @ 2017-08-01 11:18 UTC (permalink / raw)
  To: kaushal.modi; +Cc: emacs-orgmode

Hi,

Kaushal Modi <kaushal.modi@gmail.com> writes:

> With the new patch, wouldn't the title, that was not intended to be shown,
> still show up in places like browser tabs and bookmarks? I have to yet try
> it.

Yes, but that’s a feature.  It’s how ox-{latex,odt} works as well (via
hyperref).

> 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.

> But if one needs to hide the title, I think it should not leak out of
> the Org document.

This is inconsistent compared to ox-odt and ox-latex cf. above.  While the
two are not entire consistent in general, they are consistent in keeping
the title as meta data, while not printing it.

> That would be fine if that prevents the title from showing up in browser
> tabs, etc.

It does not.  We could change the manual to be more clear about this (it
says title "toggle[s] inclusion of title").

Rasmus

-- 
History is what should never happen again

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export.
  2017-08-01 11:18         ` Rasmus
@ 2017-08-01 19:41           ` Kaushal Modi
  2017-08-01 20:48             ` Rasmus
  0 siblings, 1 reply; 15+ messages in thread
From: Kaushal Modi @ 2017-08-01 19:41 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

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

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 <rasmus@gmx.us> 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

[-- Attachment #2: Type: text/html, Size: 3250 bytes --]

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export.
  2017-08-01 19:41           ` Kaushal Modi
@ 2017-08-01 20:48             ` Rasmus
  2017-08-01 20:59               ` Kaushal Modi
  2017-08-01 22:03               ` Tim Cross
  0 siblings, 2 replies; 15+ messages in thread
From: Rasmus @ 2017-08-01 20:48 UTC (permalink / raw)
  To: kaushal.modi; +Cc: emacs-orgmode

Hi Kaushal,

Kaushal Modi <kaushal.modi@gmail.com> writes:

> Your patch to fix printing of h1 title when :with-title is nil looks good.
>
> More comments below.

OK I’ll push it then. 

> Here is my attempt to fix it (below is a whitespace ignored diff):

Thanks for looking into this.  That hack really leaves the title on the
tabs completely blank!  I’ve never seen anything like it.  It’s in line
with other exporters, so on that front it’s fine.  I do wonder if it’s the
right thing to do.  When the title is blank Firefox (and I assume other
browsers) show the path.  With &lrm it’s completely blank.

I am fine with this approach, but I’m not particularly fond about how it
looks in Firefox and Chromium...

> 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))

Perhaps this would be simpler?

    (or (org-string-nw-p (org-export-data (plist-get info :title) info)) "&lrm;")

> 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?

It is indeed valid according to the validator.

Thanks,
Rasmus


-- 
Summon the Mothership!

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export.
  2017-08-01 20:48             ` Rasmus
@ 2017-08-01 20:59               ` Kaushal Modi
  2017-08-09  9:56                 ` Rasmus
  2017-08-01 22:03               ` Tim Cross
  1 sibling, 1 reply; 15+ messages in thread
From: Kaushal Modi @ 2017-08-01 20:59 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

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

On Tue, Aug 1, 2017 at 4:48 PM Rasmus <rasmus@gmx.us> wrote:

> Thanks for looking into this.  That hack really leaves the title on the
> tabs completely blank!


That was the idea.. If someone sets "#+TITLE:", they expect *no* title :)


> I’ve never seen anything like it.  It’s in line
> with other exporters, so on that front it’s fine.  I do wonder if it’s the
> right thing to do.  When the title is blank Firefox (and I assume other
> browsers) show the path.  With &lrm it’s completely blank.
>

I liked seeing that was possible.


> Perhaps this would be simpler?
>
>     (or (org-string-nw-p (org-export-data (plist-get info :title) info))
> "&lrm;")
>

Of course. I thought I was missing out on something. Thanks.


>
> > 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?
>
> It is indeed valid according to the validator.
>

Thanks for checking. The validator (the default one in org-html-postamble)
never worked for me, probably because of something being blocked at work..
I get this when I click the validator link:

=====
Sorry! This document cannot be checked.
No Referer header found!

You have requested we check the referring page, but your browser did not
send the HTTP "Referer" header field. This can be for several reasons, but
most commonly it is because your browser does not know about this header,
has been configured not to send one, transferred the referring document
over a secure protocol such as https but is accessing the validator over
ordinary non-secure http, or is behind a proxy or firewall that strips it
out of the request before it reaches us.

This is not an error in the referring page!
=====

Being able to set the title to blank is really cool. I have never needed to
do that. But if someone (OP? OP's list email bounces back, so assuming they
are subscribed to this ML) wants that, we now know how.
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 3229 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export.
  2017-08-01  9:51     ` Rasmus
  2017-08-01 10:41       ` Kaushal Modi
@ 2017-08-01 21:58       ` Tim Cross
  1 sibling, 0 replies; 15+ messages in thread
From: Tim Cross @ 2017-08-01 21:58 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode


I think I agree. All HTML documents should have a title tag. Not all
HTML documents need a h1-title. I think the easy solution is to just
default to document name when no title is set and don't add a
h1-title. If a title block is set, then do as is now the case.

tim

Rasmus writes:

> Kaushal Modi <kaushal.modi@gmail.com> writes:
>
>> This patch fixes this:
>>
>> From e57e9e798dd1a54cae7a633fc67e2f825b967eea Mon Sep 17 00:00:00 2001
>> From: Kaushal Modi <kaushal.modi@gmail.com>
>> 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 <lists@wilkesley.net>
>> ---
>>  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 <rasmus@gmx.us>
> 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: lists@wilkesley.net
> <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


-- 
Tim Cross

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export.
  2017-08-01 20:48             ` Rasmus
  2017-08-01 20:59               ` Kaushal Modi
@ 2017-08-01 22:03               ` Tim Cross
  1 sibling, 0 replies; 15+ messages in thread
From: Tim Cross @ 2017-08-01 22:03 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode, kaushal.modi


While I totally agree with your sentiments, I don't think we should
worry about how/what the browser renders. We should ensure valid HTML
and leave how this is interpreted/rendered to the browsers.

Alternative is we jump through lots of hoops trying to get something
which looks reasonable in all browsers and then find it all gets broken
after next browser version is released.

I do think the idea of clarifying and perhaps making suggestions in the
manual is a good approach - let the author have as much control as
possible.

Tim

Rasmus writes:

> Hi Kaushal,
>
> Kaushal Modi <kaushal.modi@gmail.com> writes:
>
>> Your patch to fix printing of h1 title when :with-title is nil looks good.
>>
>> More comments below.
>
> OK I’ll push it then. 
>
>> Here is my attempt to fix it (below is a whitespace ignored diff):
>
> Thanks for looking into this.  That hack really leaves the title on the
> tabs completely blank!  I’ve never seen anything like it.  It’s in line
> with other exporters, so on that front it’s fine.  I do wonder if it’s the
> right thing to do.  When the title is blank Firefox (and I assume other
> browsers) show the path.  With &lrm it’s completely blank.
>
> I am fine with this approach, but I’m not particularly fond about how it
> looks in Firefox and Chromium...
>
>> 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))
>
> Perhaps this would be simpler?
>
>     (or (org-string-nw-p (org-export-data (plist-get info :title) info)) "&lrm;")
>
>> 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?
>
> It is indeed valid according to the validator.
>
> Thanks,
> Rasmus


-- 
Tim Cross

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export.
  2017-08-01 20:59               ` Kaushal Modi
@ 2017-08-09  9:56                 ` Rasmus
  2017-08-09 10:38                   ` Rasmus
  2017-08-14 20:15                   ` Kaushal Modi
  0 siblings, 2 replies; 15+ messages in thread
From: Rasmus @ 2017-08-09  9:56 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Kaushal Modi <kaushal.modi@gmail.com> writes:

> Thanks for checking. The validator (the default one in org-html-postamble)
> never worked for me, probably because of something being blocked at work..
> I get this when I click the validator link:
>
> =====
> Sorry! This document cannot be checked.
> No Referer header found!
>
> You have requested we check the referring page, but your browser did not
> send the HTTP "Referer" header field. This can be for several reasons, but
> most commonly it is because your browser does not know about this header,
> has been configured not to send one, transferred the referring document
> over a secure protocol such as https but is accessing the validator over
> ordinary non-secure http, or is behind a proxy or firewall that strips it
> out of the request before it reaches us.
>
> This is not an error in the referring page!
> =====

There’s definitely some sort of issue...

I guess this is for a local file?  I guess it needs to be publicly
available.  But it doesn’t seem to work all the time even for public
pages.

Using the following example, it only works from the http version, not the
https version.

    https://pages.gitlab.io/org-mode/
    http://pages.gitlab.io/org-mode/

Rasmus

-- 
Send from my Emacs

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export.
  2017-08-09  9:56                 ` Rasmus
@ 2017-08-09 10:38                   ` Rasmus
  2017-08-14 20:15                   ` Kaushal Modi
  1 sibling, 0 replies; 15+ messages in thread
From: Rasmus @ 2017-08-09 10:38 UTC (permalink / raw)
  To: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> Hi,
>
> Kaushal Modi <kaushal.modi@gmail.com> writes:
>
>> Thanks for checking. The validator (the default one in org-html-postamble)
>> never worked for me, probably because of something being blocked at work..
>> I get this when I click the validator link:
>>
>> =====
>> Sorry! This document cannot be checked.
>> No Referer header found!
>>
>> You have requested we check the referring page, but your browser did not
>> send the HTTP "Referer" header field. This can be for several reasons, but
>> most commonly it is because your browser does not know about this header,
>> has been configured not to send one, transferred the referring document
>> over a secure protocol such as https but is accessing the validator over
>> ordinary non-secure http, or is behind a proxy or firewall that strips it
>> out of the request before it reaches us.
>>
>> This is not an error in the referring page!
>> =====
>
> There’s definitely some sort of issue...
>
> I guess this is for a local file?  I guess it needs to be publicly
> available.  But it doesn’t seem to work all the time even for public
> pages.
>
> Using the following example, it only works from the http version, not the
> https version.

Https pages not working is a known "bug" cf.

    https://validator.w3.org/docs/help.html#faq-referer

If a JS solution is OK, we could do something like this:

  <a href="http://validator.w3.org/check?uri=referer"
     onclick="this.href=
    'https://validator.w3.org/check?uri='+encodeURIComponent(document.URL)">
    Validate
  </a>

This would work with public https pages if JS is supported.  See:

    https://validator.w3.org/favelets.html
    https://lists.w3.org/Archives/Public/www-validator/2005Mar/0011.html

I have not found a way to send the raw source code via an url for local
files.

Rasmus

-- 
Dobbelt-A

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export.
  2017-08-09  9:56                 ` Rasmus
  2017-08-09 10:38                   ` Rasmus
@ 2017-08-14 20:15                   ` Kaushal Modi
  1 sibling, 0 replies; 15+ messages in thread
From: Kaushal Modi @ 2017-08-14 20:15 UTC (permalink / raw)
  To: Rasmus, emacs-orgmode

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

On Wed, Aug 9, 2017 at 5:58 AM Rasmus <rasmus@gmx.us> wrote:

> There’s definitely some sort of issue...
>
> I guess this is for a local file?


Correct. I was testing it out only on an HTML file (local) exported from
org.


>   I guess it needs to be publicly
> available.  But it doesn’t seem to work all the time even for public
> pages.
>
> Using the following example, it only works from the http version, not the
> https version.
>
>     https://pages.gitlab.io/org-mode/
>     http://pages.gitlab.io/org-mode/


OK. Thanks for the info.

About the fix for blank titles, I just pushed it to master (
http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=c8ade76ca2d579e9415cb3588605a6c98803f413
 ).
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 1566 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-08-14 20:15 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-31 17:35 Bug? Setting #+OPTIONS: title:nil Seems to Be Ignored in HTML Export lists
2017-07-31 18:24 ` Kaushal Modi
2017-07-31 18:33   ` Kaushal Modi
2017-08-01  8:15     ` Nicolas Goaziou
2017-08-01  9:51     ` Rasmus
2017-08-01 10:41       ` Kaushal Modi
2017-08-01 11:18         ` Rasmus
2017-08-01 19:41           ` Kaushal Modi
2017-08-01 20:48             ` Rasmus
2017-08-01 20:59               ` Kaushal Modi
2017-08-09  9:56                 ` Rasmus
2017-08-09 10:38                   ` Rasmus
2017-08-14 20:15                   ` Kaushal Modi
2017-08-01 22:03               ` Tim Cross
2017-08-01 21:58       ` Tim Cross

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).