On Sat, Mar 16, 2024 at 09:29:59AM +0200, Eli Zaretskii wrote:
> If and when we understand the rationale for that code, and you can
> suggest how to achieve the same with texi2any customizations, I can
> assure you that we in the Emacs maintenance will enthusiastically
> consider switching to those customizations.
Here is a proposal for an init file. The <div> placement in split case
was not that easy to achieve.
It unveiled bugs in texi2any and showed the need for a new customization
variable so it will only work correctly with the development
version/next release.
I left the <link> in <head> that are removed by the admin.el script, as
I think it is better to leave them in and my feeling is that their
removal is not intended. I also left the copyright in comment because
to remove it would mean having the whole beginning of file code redone
in the init file, which is possible, but much more of a burden for long
term maintenance. Also, even if you could prefer if this copyright
comment was not there, I do not think that it is very important as it is
a comment.
A side note on the added link and meta, I kept them as is but for
"<link rev=\"made\" href=\"mailto:bug-gnu-em...@gnu.org\">
I read on
https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel
that "made" is obsolete and should be replaced by "author" (although
processors should already do that).
I also have a doubt on the ICBM meta, I am not familiar enough with Boston
outskirts to know if the ICBM is still valid, but I think that it should be
checked by someone who could know:
"<meta name=\"ICBM\" content=\"42.256233,-71.006581\">"
--
Pat
use strict;
texinfo_set_from_init_file('TOP_BUTTONS', undef);
texinfo_set_from_init_file('EXTRA_HEAD',
'<link rev="made" href="mailto:bug-gnu-em...@gnu.org">
<link rel="icon" type="image/png" href="/graphics/gnu-head-mini.png">
<meta name="ICBM" content="42.256233,-71.006581">
<meta name="DC.title" content="gnu.org">
');
# The following adds a <div>. This is only done for the Top element
# if split. The opening div is at the same place, right after body open
# if split and non-split. The div is closed at the end of the document
# if non-split and at the end of the top element before the table of
# contents if split.
# used if split
sub _emacs_texinfo_html_customization_convert_heading_command($$$$$)
{
my $self = shift;
my $cmdname = shift;
my $element = shift;
my $args = shift;
my $content = shift;
# div opening is before the Top node, after body open
if ($cmdname eq 'node' and $element->{'extra'}
and $element->{'extra'}->{'normalized'} eq 'Top') {
my $result = &{$self->default_command_conversion($cmdname)}($self,
$cmdname, $element, $args, $content);
return '<div id="content" class="inner">'."\n".$result;
# div closing is at the end of the top element, before the after_top
# contents
} elsif ($cmdname eq 'top') {
return &{$self->default_command_conversion($cmdname)}($self,
$cmdname, $element, $args, $content . "</div>\n");
}
# call the default formatting function for other nodes
return &{$self->default_command_conversion($cmdname)}($self,
$cmdname, $element, $args, $content);
}
if (defined(texinfo_get_conf('SPLIT')) and texinfo_get_conf('SPLIT') eq '') {
# if non-split, the div is closed at the end of the document
texinfo_set_from_init_file('AFTER_BODY_OPEN',
'<div id="content" class="inner">'."\n");
texinfo_set_from_init_file('PRE_BODY_CLOSE', "</div>\n");
} else {
foreach my $cmdname ('top', 'node') {
texinfo_register_command_formatting($cmdname,
\&_emacs_texinfo_html_customization_convert_heading_command);
}
}
sub _emacs_texinfo_html_customization_format_css_lines($;$)
{
my $self = shift;
my $filename = shift;
return '<style type="text/css">
@import url(\'/software/emacs/manual.css\');
</style>
';
}
texinfo_register_formatting_function('format_css_lines',
\&_emacs_texinfo_html_customization_format_css_lines);
1;