On Wed, Aug 14, 2024 at 06:40:10PM +0100, Gavin Smith wrote:
> It is easy enough, I expect, to achieve such links by post-processing
> the HTML output, but adding built-in support in texi2any to add external
> navigation links might be worth considering, in order to make it more
> convenient.
Not sure that it is convenient enough, but using a function for a button
is how it has been done for the Singular manual for ages. An init file
based on the Singular manual has been kept for tests, it is in
tp/t/init/t2h_singular.init. There, we can see the use of a function
for a button to add a link to an external url in the navigation buttons:
sub singular_banner
{
my $result = '';
$result .= <<EOT;
<a href="index.htm"><img
src="${T2H_SING_base_images}singular-icon-transparent.png" width="50"
border="0" alt="Top"></a>
EOT
return ($result, 0);
}
my @SECTION_BUTTONS =
(
\&singular_banner,
'Back', 'Forward', 'FastBack', 'FastForward',
'Up', 'Top', 'Contents', 'Index', 'About'
);
As a side note, it could be preferable to add to the existing buttons,
rather than set @SECTION_BUTTONS, as done in
t/init/special_element_customization.pm:
# avoid doing twice if there are more than one manual processed
my $button_added;
sub _texi2any_tests_special_unit_add_button
{
my ($self, $document, $stage) = @_;
if (!$button_added) {
my @section_buttons = @{$self->get_conf('SECTION_BUTTONS')};
push @section_buttons, (' ', 'Overview');
$self->set_conf('SECTION_BUTTONS', \@section_buttons);
$button_added = 1;
}
}
texinfo_register_handler('setup', \&_texi2any_tests_special_unit_add_button);
--
Pat