--- ffmpeg-6.0/doc/t2h.pm 2022-11-04 22:16:28.000000000 +0200 +++ t2h.pm.BAK 2023-10-26 00:47:01.128352085 +0300 @@ -19,9 +19,11 @@ # You should have received a copy of the GNU General Public # License along with FFmpeg; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +use lib '/usr/share/texinfo/Texinfo/Convert'; +use Texinfo::Convert::Converter; # no navigation elements -set_from_init_file('HEADERS', 0); +texinfo_set_from_init_file('HEADERS', 0); sub ffmpeg_heading_command($$$$$) { @@ -60,66 +62,68 @@ } my $heading_level; - # node is used as heading if there is nothing else. - if ($cmdname eq 'node') { - if (!$element or (!$element->{'extra'}->{'section'} - and $element->{'extra'}->{'node'} - and $element->{'extra'}->{'node'} eq $command - # bogus node may not have been normalized - and defined($command->{'extra'}->{'normalized'}))) { - if ($command->{'extra'}->{'normalized'} eq 'Top') { - $heading_level = 0; - } else { - $heading_level = 3; - } - } + +if ($cmdname eq 'node') { + if (!$element or ( + $element->{'extra'}->{'section'} and + $element->{'extra'}->{'node'} and + $element->{'extra'}->{'node'} eq $command and + defined($command->{'extra'}->{'normalized'}) + )) { + $heading_level = 0; # Set heading level to 0 } else { - $heading_level = $command->{'level'}; + $heading_level = 3; } +} else { + $heading_level = $command->{'level'}; +} - my $heading = $self->command_text($command); - # $heading not defined may happen if the command is a @node, for example - # if there is an error in the node. - if (defined($heading) and $heading ne '' and defined($heading_level)) { - - if ($Texinfo::Common::root_commands{$cmdname} - and $Texinfo::Common::sectioning_commands{$cmdname}) { - my $content_href = $self->command_contents_href($command, 'contents', - $self->{'current_filename'}); - if ($content_href) { - my $this_href = $content_href =~ s/^\#toc-/\#/r; - $heading .= ''. - ''; - } +my $heading = $self->command_text($command); + +if (defined($heading) and $heading ne '' and defined($heading_level)) { + if ($Texinfo::Common::root_commands{$cmdname} + and $Texinfo::Common::sectioning_commands{$cmdname}) { + my $content_href = $self->command_contents_href($command, 'contents', $self->{'current_filename'}); + if ($content_href) { + my $this_href = $content_href =~ s/^\#toc-/\#/r; + $heading .= ' '. - ' '. - ''. + ''; } + } - if ($self->in_preformatted()) { - $result .= $heading."\n"; - } else { - # if the level was changed, set the command name right - if ($cmdname ne 'node' - and $heading_level ne $Texinfo::Common::command_structuring_level{$cmdname}) { - $cmdname - = $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level]; - } - $result .= &{$self->{'format_heading_text'}}( - $self, $cmdname, $heading, - $heading_level + - $self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command); + if ($self->in_preformatted()) { + $result .= $heading."\n"; + } else { + if ($cmdname ne 'node' + and $heading_level ne $Texinfo::Common::command_structuring_level{$cmdname}) { + $cmdname + = $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level]; } + if ($cmdname ne 'node') { + # Only add class if the command is not "node" + $result .= &{$self->formatting_function('format_heading_text')}( + $self, $cmdname, $heading, + $heading_level + + $self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command); +} else { + # Handle "Top" differently, without adding class + $result .= $heading . "\n"; +} } - $result .= $content if (defined($content)); - return $result; +} +$result .= $content if (defined($content)); + +return $result; } foreach my $command (keys(%Texinfo::Common::sectioning_commands), 'node') { @@ -127,22 +131,22 @@ } # determine if texinfo is at least version 6.8 -my $program_version_num = version->declare(get_conf('PACKAGE_VERSION'))->numify; +my $program_version_num = version->declare(texinfo_get_conf('PACKAGE_VERSION'))->numify; my $program_version_6_8 = $program_version_num >= 6.008000; # print the TOC where @contents is used if ($program_version_6_8) { - set_from_init_file('CONTENTS_OUTPUT_LOCATION', 'inline'); + texinfo_set_from_init_file('CONTENTS_OUTPUT_LOCATION', 'inline'); } else { - set_from_init_file('INLINE_CONTENTS', 1); + texinfo_set_from_init_file('INLINE_CONTENTS', 1); } # make chapters ' . + ' '. + '