* ox-html: Bug or feature for export of title and meta information?
@ 2019-09-21 12:20 Jens Lechtenboerger
2020-02-11 8:16 ` Bastien
0 siblings, 1 reply; 13+ messages in thread
From: Jens Lechtenboerger @ 2019-09-21 12:20 UTC (permalink / raw)
To: emacs-orgmode
Hi there,
I wonder about the treatment of different pieces of HTML header
information in org-html--build-meta-info: Contents for the title
element are computed by org-export-data. This interprets Org markup
such as italics or hyperlinks although title elements are not
allowed to contain the resulting sub-elements. Why is
org-export-data applied? Why not produce plain text?
Contents for the description and keywords meta attributes are
computed with org-html-encode-plain-text and replacement of
quotation marks. Seems fine to me.
Contents for the author meta attribute are computed with
org-element-interpret-data, before org-html-encode-plain-text and
quotation mark replacement are applied. How would author
information look like that benefits from this more complex treatment
(compared to description and keywords)?
Thanks
Jens
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ox-html: Bug or feature for export of title and meta information?
2019-09-21 12:20 ox-html: Bug or feature for export of title and meta information? Jens Lechtenboerger
@ 2020-02-11 8:16 ` Bastien
2020-02-14 17:21 ` Jens Lechtenboerger
0 siblings, 1 reply; 13+ messages in thread
From: Bastien @ 2020-02-11 8:16 UTC (permalink / raw)
To: Jens Lechtenboerger; +Cc: emacs-orgmode
Hi Jens,
it is difficult to justify existing code, it is easier to answer to
bug reports. If you think there is a bug in this aread, can you tell
what it is?
https://orgmode.org/org.html#Feedback might help.
Thanks!
--
Bastien
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ox-html: Bug or feature for export of title and meta information?
2020-02-11 8:16 ` Bastien
@ 2020-02-14 17:21 ` Jens Lechtenboerger
2020-02-14 19:31 ` Nicolas Goaziou
0 siblings, 1 reply; 13+ messages in thread
From: Jens Lechtenboerger @ 2020-02-14 17:21 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
On 2020-02-11, at 09:16, Bastien wrote:
> Hi Jens,
>
> it is difficult to justify existing code, it is easier to answer to
> bug reports. If you think there is a bug in this aread, can you tell
> what it is?
Hi Bastien,
many thanks for following up on this!
I see two or more bugs:
1. Export to HTML when the title contains markup, say this one:
#+TITLE: This does *not* work
The HTML title element contains a nested b element, which is
invalid as only text is allowed.
2. The documentation does not explain which headers are exported how
to HTML. I described different variants in my previous e-mail.
I’m not sure whether there was a reason to treat them differently.
So, this is at least a bug in the documentation (with potentially
more bugs in the code if the current treatment was not desirable).
Best wishes
Jens
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ox-html: Bug or feature for export of title and meta information?
2020-02-14 17:21 ` Jens Lechtenboerger
@ 2020-02-14 19:31 ` Nicolas Goaziou
2020-02-14 19:38 ` Nicolas Goaziou
2020-02-15 7:45 ` Jens Lechtenboerger
0 siblings, 2 replies; 13+ messages in thread
From: Nicolas Goaziou @ 2020-02-14 19:31 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
Hello,
Jens Lechtenboerger <jens.lechtenboerger@fsfe.org> writes:
> 1. Export to HTML when the title contains markup, say this one:
>
> #+TITLE: This does *not* work
What does not work?
> The HTML title element contains a nested b element, which is
> invalid as only text is allowed.
Who said that? The above is perfectly valid.
> 2. The documentation does not explain which headers are exported how
> to HTML.
Some keywords have are more important than others, since they have
a special meaning during export, e.g., TITLE vs. RANDOM_FOO.
General export rules are described in ox.el (org-export-options-alist),
then each export back-end define its own specificities (look at the
back-end definition).
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ox-html: Bug or feature for export of title and meta information?
2020-02-14 19:31 ` Nicolas Goaziou
@ 2020-02-14 19:38 ` Nicolas Goaziou
2020-02-14 20:47 ` Bastien
2020-02-15 7:45 ` Jens Lechtenboerger
1 sibling, 1 reply; 13+ messages in thread
From: Nicolas Goaziou @ 2020-02-14 19:38 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
Completing myself,
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> General export rules are described in ox.el (org-export-options-alist),
> then each export back-end define its own specificities (look at the
> back-end definition).
This doesn't mean the manual cannot be improved, of course. Improvements
are welcome in that area.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ox-html: Bug or feature for export of title and meta information?
2020-02-14 19:38 ` Nicolas Goaziou
@ 2020-02-14 20:47 ` Bastien
2020-02-15 14:35 ` Nicolas Goaziou
0 siblings, 1 reply; 13+ messages in thread
From: Bastien @ 2020-02-14 20:47 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode
Hi Nicolas,
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> This doesn't mean the manual cannot be improved, of course. Improvements
> are welcome in that area.
I see org-export-options-alist is not mentioned in the manual - would
it be worth mentioning it in the "Adding Export Back-ends" section?
--
Bastien
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ox-html: Bug or feature for export of title and meta information?
2020-02-14 19:31 ` Nicolas Goaziou
2020-02-14 19:38 ` Nicolas Goaziou
@ 2020-02-15 7:45 ` Jens Lechtenboerger
2020-02-15 14:02 ` Nicolas Goaziou
1 sibling, 1 reply; 13+ messages in thread
From: Jens Lechtenboerger @ 2020-02-15 7:45 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
On 2020-02-14, at 20:31, Nicolas Goaziou wrote:
> Hello,
>
> Jens Lechtenboerger <jens.lechtenboerger@fsfe.org> writes:
>
>> 1. Export to HTML when the title contains markup, say this one:
>>
>> #+TITLE: This does *not* work
>
> What does not work?
>
>> The HTML title element contains a nested b element, which is
>> invalid as only text is allowed.
>
> Who said that? The above is perfectly valid.
Good morning (over here),
the W3C Markup Validator [1] disagrees with this output from
ox-html (which I reduced to the essential parts):
#+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>
<title>This does <b>not</b> work</title>
</head>
<body><p></p></body></html>
#+end_src
Best wishes
Jens
[1] https://validator.w3.org/#validate_by_input
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ox-html: Bug or feature for export of title and meta information?
2020-02-15 7:45 ` Jens Lechtenboerger
@ 2020-02-15 14:02 ` Nicolas Goaziou
2020-02-16 18:16 ` Jens Lechtenboerger
0 siblings, 1 reply; 13+ messages in thread
From: Nicolas Goaziou @ 2020-02-15 14:02 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
Hello,
Jens Lechtenboerger <jens.lechtenboerger@fsfe.org> writes:
> the W3C Markup Validator [1] disagrees with this output from
> ox-html (which I reduced to the essential parts):
OK. I was talking about the Org syntax. I misread your initial report.
I won't comment about the generated HTML. If needed, the HTML exporter
can prevent parsing TITLE keyword.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ox-html: Bug or feature for export of title and meta information?
2020-02-14 20:47 ` Bastien
@ 2020-02-15 14:35 ` Nicolas Goaziou
2020-02-16 10:44 ` Bastien
0 siblings, 1 reply; 13+ messages in thread
From: Nicolas Goaziou @ 2020-02-15 14:35 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
Hello,
Bastien <bzg@gnu.org> writes:
> I see org-export-options-alist is not mentioned in the manual - would
> it be worth mentioning it in the "Adding Export Back-ends" section?
I don't think so. It is a constant, which may only matter when you write
an export-backend. Its value is not even particularly important since
any back-end can ignore it. Only its syntax really matters, as pointed
out in, e.g., `org-export-define-derived-backend' docstring. To sum it
up, I see it is an implementation detail.
The manual might, however, be more rigorous about what keywords each
back-end really interprets. I don't know how, and where, it could fit,
tho.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ox-html: Bug or feature for export of title and meta information?
2020-02-15 14:35 ` Nicolas Goaziou
@ 2020-02-16 10:44 ` Bastien
0 siblings, 0 replies; 13+ messages in thread
From: Bastien @ 2020-02-16 10:44 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode
Hi Nicolas,
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> I don't think so. It is a constant, which may only matter when you write
> an export-backend. Its value is not even particularly important since
> any back-end can ignore it. Only its syntax really matters, as pointed
> out in, e.g., `org-export-define-derived-backend' docstring. To sum it
> up, I see it is an implementation detail.
I see, thanks.
> The manual might, however, be more rigorous about what keywords each
> back-end really interprets. I don't know how, and where, it could fit,
> tho.
I guess a tutorial on how to write a new export backend will give us a
hint on where and how to mention this. I am not sure it belongs to the
manual.
Best,
--
Bastien
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ox-html: Bug or feature for export of title and meta information?
2020-02-15 14:02 ` Nicolas Goaziou
@ 2020-02-16 18:16 ` Jens Lechtenboerger
2020-02-17 9:47 ` Nicolas Goaziou
0 siblings, 1 reply; 13+ messages in thread
From: Jens Lechtenboerger @ 2020-02-16 18:16 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
Hi there!
On 2020-02-15, at 15:02, Nicolas Goaziou wrote:
> Jens Lechtenboerger <jens.lechtenboerger@fsfe.org> writes:
>
>> the W3C Markup Validator [1] disagrees with this output from
>> ox-html (which I reduced to the essential parts):
>
> OK. I was talking about the Org syntax. I misread your initial report.
>
> I won't comment about the generated HTML. If needed, the HTML exporter
> can prevent parsing TITLE keyword.
I do not know what is needed. Function org-html--build-meta-info
should return valid XHTML (also in case of HTML5, I believe that
Org syntax is preferable over ignored [1] HTML tags).
Based on the treatment of meta elements for author and description
in that function, alternatives might use org-element-interpret-data
(author) or not (description). I do not understand the role of
org-element-interpret-data to generate author information. Which
“non exportable objects” can be skipped by that function (as
mentioned in a comment in org-html--build-meta-info)? Should they
also be skipped for description or title?
Best wishes
Jens
[1] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ox-html: Bug or feature for export of title and meta information?
2020-02-16 18:16 ` Jens Lechtenboerger
@ 2020-02-17 9:47 ` Nicolas Goaziou
2020-02-17 18:32 ` Jens Lechtenboerger
0 siblings, 1 reply; 13+ messages in thread
From: Nicolas Goaziou @ 2020-02-17 9:47 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
Hello,
Jens Lechtenboerger <jens.lechtenboerger@fsfe.org> writes:
> Based on the treatment of meta elements for author and description
> in that function, alternatives might use org-element-interpret-data
> (author) or not (description). I do not understand the role of
> org-element-interpret-data to generate author information.
`org-element-interpret-data' means: "down with HTML, go back to Org
syntax". IOW, it mean the author is supplied as-is.
> Which “non exportable objects” can be skipped by that function (as
> mentioned in a comment in org-html--build-meta-info)? Should they also
> be skipped for description or title?
That non-exportable part is confusing. I think
(org-element-interpret-data auth)
is sufficient. I pushed a change in that direction.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ox-html: Bug or feature for export of title and meta information?
2020-02-17 9:47 ` Nicolas Goaziou
@ 2020-02-17 18:32 ` Jens Lechtenboerger
0 siblings, 0 replies; 13+ messages in thread
From: Jens Lechtenboerger @ 2020-02-17 18:32 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
Hi there!
On 2020-02-17, at 10:47, Nicolas Goaziou wrote:
> Jens Lechtenboerger <jens.lechtenboerger@fsfe.org> writes:
>> Which “non exportable objects” can be skipped by that function (as
>> mentioned in a comment in org-html--build-meta-info)? Should they also
>> be skipped for description or title?
>
> That non-exportable part is confusing. I think
>
> (org-element-interpret-data auth)
>
> is sufficient. I pushed a change in that direction.
Thank you!
The function org-element-interpret-data seems to return the empty
string for nil. Is that by contract or accident? In the former
case, maybe use
(org-element-interpret-data (plist-get info :author))
instead of the let statement?
What do you think about applying org-element-interpret-data (instead
of org-export-data) when let-binding title, like the following?
(org-html-encode-plain-text
(org-element-interpret-data (plist-get info :title)))
As far as I can tell, this would create valid (X)HTML.
Best wishes
Jens
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2020-02-17 18:32 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-21 12:20 ox-html: Bug or feature for export of title and meta information? Jens Lechtenboerger
2020-02-11 8:16 ` Bastien
2020-02-14 17:21 ` Jens Lechtenboerger
2020-02-14 19:31 ` Nicolas Goaziou
2020-02-14 19:38 ` Nicolas Goaziou
2020-02-14 20:47 ` Bastien
2020-02-15 14:35 ` Nicolas Goaziou
2020-02-16 10:44 ` Bastien
2020-02-15 7:45 ` Jens Lechtenboerger
2020-02-15 14:02 ` Nicolas Goaziou
2020-02-16 18:16 ` Jens Lechtenboerger
2020-02-17 9:47 ` Nicolas Goaziou
2020-02-17 18:32 ` Jens Lechtenboerger
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.