help-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to avoid mini toc in HTML output


From: Patrice Dumas
Subject: Re: How to avoid mini toc in HTML output
Date: Sat, 30 Dec 2023 18:38:07 +0100

On Sat, Dec 30, 2023 at 04:28:02PM +0100, Hilaire Fernandes wrote:
> Hi folks,
> 
> I just upgraded some documentation to 7.x.
> 
> How can I avoid the mini-toc in the middle of the html document. See in the
> examples below. The first example is really confusing.

How the 'menus' are formatted depend on FORMAT_MENU customization
variable, which is now 'sectiontoc' by default.  It is possible to get
back to menu, by setting FORMAT_MENU to menu.  From the command line:

 texi2any --html -c FORMAT_MENU=menu manual.texi

or remove completly any type of menu by setting FORMAT_MENU to nomenu:

 texi2any --html -c FORMAT_MENU=nomenu manual.texi

But it is not clear to me that it is what you want, as it seems to me
that a mini-toc or a menu is needed in some cases for navigation, as in
the following page:
https://cuis-smalltalk.github.io/TheCuisBook/The-Fundamentals-of-Morph.html

This would probably require some code and a replacement of the nodes and
sectioning commands conversion function, _convert_heading_command, with
a change where the mini_toc is output, and here output the mini toc only
if $element->{'extra'}->{'section_level'} is below a given level,
something like

    if ($self->get_conf('FORMAT_MENU') eq 'sectiontoc') {
      if ($element->{'extra'}->{'section_level'} <= 1) {
        $mini_toc_or_auto_menu = _mini_toc($self, $element);
      }

The level could depend on the split option, the document seems to be
split at sections.

This would require an init file where you can copy the _convert_heading_command
code from texinfo tp/Texinfo/Convert/HTML.pm file, rename the function,
modify it, and associate it to the node and sectioning commands
conversion with:

foreach my $command (keys(%Texinfo::Commands::sectioning_heading_commands), 
'node') {
  texinfo_register_command_formatting ($command, 
\&my_modified_convert_heading_command);
}



> 
> https://cuis-smalltalk.github.io/TheCuisBook/Daily-Workflow.html#Automate-your-image
> 
> https://cuis-smalltalk.github.io/TheCuisBook/Going-Vector.html
> 
> Of course the main table of contents is still needed.

-- 
Pat



reply via email to

[Prev in Thread] Current Thread [Next in Thread]