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

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 04 Jul 2022 12:42:42 +0200

Eli Zaretskii <[email-masked]> writes:

> makeinfo is supposed to be a symlink to texi2any.

Yes, indeed.

> 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 tried running the code now (and commented out the
manual-html-fix-headers function), and I ended up with:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This file describes the Emacs auth-source library.

Copyright (C) 2008-2022 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with the Front-Cover Texts being "A GNU Manual,"
and with the Back-Cover Texts as in (a) below.  A copy of the license
is included in the section entitled "GNU Free Documentation License".

(a) The FSF's Back-Cover Text is: "You have the freedom to copy and
modify this GNU manual." -->
<title>Emacs auth-source Library 0.3</title>

This is with texi2any (GNU texinfo) 6.8.  If I'm reading the code right,
the delete-region here is just deleting that <meta, the comment, and the
<title>.

It's probably different in every texinfo version, but altering the

    (search-forward "</title>\n")

to

    (search-forward "<title>")

should be safe in any case, so I'll go ahead and do that.

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

I think altering the HTML in this way isn't idea.  It'd be much better
to just parse the HTML, alter the DOM (to remove/insert elements), and
then write the DOM out to HTML again.  That'd be a whole lot less
brittle.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no