Subject: Re: bug#48334: No <title> elements in HTML manual pages

From: Eli Zaretskii <[email-masked]>
Date: Sun, 03 Jul 2022 16:13:20 +0300

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Sun, 03 Jul 2022 14:16:27 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > I don't remember if texi2any produces <title>, but the above scripts
> > modify the HTML produced by texi2any, so what we eventually have is
> > the result of those scripts.
> 
> Hm...  it looks like the manuals are produced with "makeinfo --html",
> though -- I can't see any usage of texi2html or texi2any there, but I
> may be missing something.

makeinfo is supposed to be a symlink to texi2any.

> Ah, it's this code:
> 
> (defun manual-html-fix-headers ()
>   "Fix up HTML headers for the Emacs manual in the current buffer."
>   (let ((texi5 (search-forward "<!DOCTYPE" nil t))
> 	opoint)
> 
> [...]
> 
>     (search-forward "<meta")
>     (setq opoint (match-beginning 0))
>     (unless texi5
>       (search-forward "<!--")
>       (goto-char (match-beginning 0))
>       (delete-region opoint (point))
>       (search-forward "<meta http-equiv=\"Content-Style")
>       (setq opoint (match-beginning 0)))
>     (search-forward "</title>\n")
>     (delete-region opoint (point))

Yes.  (But that's not the only editing we do, although the rest isn't
relevant to <title>, I think.)

> So we delete the <title> that makeinfo --html has created.  Perhaps
> that's just a bug?

It is definitely done on purpose, but I don't know what is the purpose
of deleting <title> (and many other parts of the headers as well).

> I see that you adjusted this code in May...

I made changes there because someone reported a problem with reading
the manuals on mobile devices, because we were deleting the line with
'<meta name="viewport"...', which in latest Texinfo takes care of
adjusting the viewport to the width of the device display.  My changes
were supposed to avoid deletion of this header (and a few others), but
I don't think I kept <title>.

I think the solution to this is for some HTML5 expert to look at our
edits vs what Texinfo 6.8 produces, and tell which parts of the
editing are needed (and why) and which aren't.  I'm far from being
that expert.

Failing that, I think the only alternative is to see how the original
Texinfo output looks in a browser, compare that with the edited
manuals, and then decide which of the edits are really needed.  One
problem with that is that we'll probably have to require Texinfo 6.8
or later if we go that way, because maintaining compatibility with
multiple Texinfo versions is really too much.  Ideally, we should keep
the edits to the absolute minimum.