* ox-html Incorrectly (?) Puts HTML Into the `<title>` Tag
@ 2021-01-11 15:32 Tim Visher
2021-01-12 1:19 ` Kyle Meyer
0 siblings, 1 reply; 5+ messages in thread
From: Tim Visher @ 2021-01-11 15:32 UTC (permalink / raw)
To: Emacs Org Mode mailing list
[-- Attachment #1: Type: text/plain, Size: 1274 bytes --]
Hi all,
I noticed over the weekend that the `<title>` tag in an ox-html document is
populated with HTML when inline formatting like bold or italics is used.
I'm running org 9.4.4 but even on HEAD
<https://code.orgmode.org/bzg/org-mode/src/9ea7ff5e2f8f9f280f8022cade62c1a3bba1478c/lisp/ox-html.el#L2092-L2111>
this
behavior seems to be the same where `(org-export-data title …)` is used to
populate the title rather than something that would render the title
textually.
My understanding from MDN
<https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title> is that
`title` tags should never contain markup.
Is this something we'd take a patch for? My thought is that the title
should be converted using the text backend by default, perhaps with a
configuration variable that would let you specify a different one (for
instance markdown) but I wouldn't go that far at first. Of course at
minimum since org is textual it could just use the title without exporting
at all but I think that doesn't go far enough. The other possibility would
be to somehow strip all special characters from the title but I think that
goes much too far.
Thanks in advance!
--
In Christ,
Timmy V.
https://blog.twonegatives.com
http://five.sentenc.es
[-- Attachment #2: Type: text/html, Size: 1518 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ox-html Incorrectly (?) Puts HTML Into the `<title>` Tag
2021-01-11 15:32 ox-html Incorrectly (?) Puts HTML Into the `<title>` Tag Tim Visher
@ 2021-01-12 1:19 ` Kyle Meyer
2021-01-12 14:51 ` Tim Visher
0 siblings, 1 reply; 5+ messages in thread
From: Kyle Meyer @ 2021-01-12 1:19 UTC (permalink / raw)
To: Tim Visher; +Cc: Emacs Org Mode mailing list
Tim Visher writes:
> Hi all,
>
> I noticed over the weekend that the `<title>` tag in an ox-html document is
> populated with HTML when inline formatting like bold or italics is used.
[...]
> Is this something we'd take a patch for?
Thanks for reporting. Is this addressed by the in-progress series at
<https://orgmode.org/list/87o8hwpz34.fsf@gmail.com/>?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ox-html Incorrectly (?) Puts HTML Into the `<title>` Tag
2021-01-12 1:19 ` Kyle Meyer
@ 2021-01-12 14:51 ` Tim Visher
2021-01-13 3:43 ` Kyle Meyer
0 siblings, 1 reply; 5+ messages in thread
From: Tim Visher @ 2021-01-12 14:51 UTC (permalink / raw)
To: Kyle Meyer; +Cc: Emacs Org Mode mailing list
[-- Attachment #1: Type: text/plain, Size: 1005 bytes --]
On Mon, Jan 11, 2021 at 8:19 PM Kyle Meyer <kyle@kyleam.com> wrote:
> Tim Visher writes:
>
> > Hi all,
> >
> > I noticed over the weekend that the `<title>` tag in an ox-html document
> is
> > populated with HTML when inline formatting like bold or italics is used.
> [...]
> > Is this something we'd take a patch for?
>
> Thanks for reporting. Is this addressed by the in-progress series at
> <https://orgmode.org/list/87o8hwpz34.fsf@gmail.com/>?
>
IIUC yes. I believe the following section of the diff should address it.
```
+ (let* ((title (org-html-plain-text
+ (org-element-interpret-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 "‎"))
```
If I'm reading the code correctly, `org-html-plain-text` is a specialized
form of converting org data into a plain text string with no markup. If I
have that correct then I believe you're right.
Is that your read as well?
[-- Attachment #2: Type: text/html, Size: 1583 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ox-html Incorrectly (?) Puts HTML Into the `<title>` Tag
2021-01-12 14:51 ` Tim Visher
@ 2021-01-13 3:43 ` Kyle Meyer
2021-01-13 15:26 ` Tim Visher
0 siblings, 1 reply; 5+ messages in thread
From: Kyle Meyer @ 2021-01-13 3:43 UTC (permalink / raw)
To: Tim Visher; +Cc: Emacs Org Mode mailing list
Tim Visher writes:
> On Mon, Jan 11, 2021 at 8:19 PM Kyle Meyer <kyle@kyleam.com> wrote:
>> Thanks for reporting. Is this addressed by the in-progress series at
>> <https://orgmode.org/list/87o8hwpz34.fsf@gmail.com/>?
>>
>
> IIUC yes. I believe the following section of the diff should address it.
[...]
> If I'm reading the code correctly, `org-html-plain-text` is a specialized
> form of converting org data into a plain text string with no markup. If I
> have that correct then I believe you're right.
>
> Is that your read as well?
Yep. And as a light test:
#+title: a *b* c
exports
<title>a *b* c</title>
rather than
<title>a <b>b</b> c</title>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ox-html Incorrectly (?) Puts HTML Into the `<title>` Tag
2021-01-13 3:43 ` Kyle Meyer
@ 2021-01-13 15:26 ` Tim Visher
0 siblings, 0 replies; 5+ messages in thread
From: Tim Visher @ 2021-01-13 15:26 UTC (permalink / raw)
To: Kyle Meyer; +Cc: Emacs Org Mode mailing list
[-- Attachment #1: Type: text/plain, Size: 1143 bytes --]
On Tue, Jan 12, 2021 at 10:43 PM Kyle Meyer <kyle@kyleam.com> wrote:
> Tim Visher writes:
>
> > On Mon, Jan 11, 2021 at 8:19 PM Kyle Meyer <kyle@kyleam.com> wrote:
>
> >> Thanks for reporting. Is this addressed by the in-progress series at
> >> <https://orgmode.org/list/87o8hwpz34.fsf@gmail.com/>?
> >>
> >
> > IIUC yes. I believe the following section of the diff should address it.
> [...]
> > If I'm reading the code correctly, `org-html-plain-text` is a specialized
> > form of converting org data into a plain text string with no markup. If I
> > have that correct then I believe you're right.
> >
> > Is that your read as well?
>
> Yep. And as a light test:
>
> #+title: a *b* c
>
> exports
>
> <title>a *b* c</title>
>
> rather than
>
> <title>a <b>b</b> c</title>
>
Nice! I don't know enough about `org-export` but FWIW the use case I have
is not to have an explicit `title` property but instead just the default
title of the heading contents. I assume that's all handled transparently by
the `(plist-get …` section.
Do you have any idea the timeline for getting that patch merged?
[-- Attachment #2: Type: text/html, Size: 1757 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-01-13 15:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-11 15:32 ox-html Incorrectly (?) Puts HTML Into the `<title>` Tag Tim Visher
2021-01-12 1:19 ` Kyle Meyer
2021-01-12 14:51 ` Tim Visher
2021-01-13 3:43 ` Kyle Meyer
2021-01-13 15:26 ` Tim Visher
unofficial mirror of emacs-orgmode@gnu.org
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://yhetil.org/orgmode/0 orgmode/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 orgmode orgmode/ https://yhetil.org/orgmode \
emacs-orgmode@gnu.org
public-inbox-index orgmode
Example config snippet for mirrors.
Newsgroups are available over NNTP:
nntp://news.yhetil.org/yhetil.emacs.orgmode
nntp://news.gmane.io/gmane.emacs.orgmode
AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git