PR #22431 opened by Gyan Doshi (GyanD) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22431 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22431.patch
On behalf of Patrice Dumas >From 51be699047184ce4f978311c20fb78ddf48baefd Mon Sep 17 00:00:00 2001 From: Patrice Dumas <[email protected]> Date: Thu, 5 Mar 2026 21:06:44 +0100 Subject: [PATCH] doc/t2h.pm: Never use node nor empty @top heading in ffmpeg_heading_command --- doc/t2h.pm | 126 ++++++++++++++++++++++------------------------------- 1 file changed, 53 insertions(+), 73 deletions(-) diff --git a/doc/t2h.pm b/doc/t2h.pm index 4875d66305..4fb17d0174 100644 --- a/doc/t2h.pm +++ b/doc/t2h.pm @@ -55,7 +55,8 @@ sub get_formatting_function($$) { # determine texinfo version my $package_version = ff_get_conf('PACKAGE_VERSION'); -$package_version =~ s/\+dev$//; +$package_version =~ s/\+nc$//; +$package_version =~ s/\+?dev$//; my $program_version_num = version->declare($package_version)->numify; my $program_version_6_8 = $program_version_num >= 6.008000; @@ -119,29 +120,8 @@ sub ffmpeg_heading_command($$$$$) } my $heading_level; - # node is used as heading if there is nothing else. - if ($cmdname eq 'node') { - if (!$output_unit or - (((!$output_unit->{'extra'}->{'section'} - and $output_unit->{'extra'}->{'node'} - and $output_unit->{'extra'}->{'node'} eq $command) - or - ((($output_unit->{'extra'}->{'unit_command'} - and $output_unit->{'extra'}->{'unit_command'} eq $command) - or - ($output_unit->{'unit_command'} - and $output_unit->{'unit_command'} eq $command)) - and $command->{'extra'} - and not $command->{'extra'}->{'associated_section'})) - # 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; - } - } - } else { + # Never use node for heading + if ($cmdname ne 'node') { if (defined($command->{'extra'}) and defined($command->{'extra'}->{'section_level'})) { $heading_level = $command->{'extra'}->{'section_level'}; @@ -153,58 +133,58 @@ sub ffmpeg_heading_command($$$$$) } } - 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 ($root_commands{$cmdname} - and $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 .= '<span class="pull-right">'. - '<a class="anchor hidden-xs" '. - "href=\"$this_href\" aria-hidden=\"true\">". - ($ENV{"FA_ICONS"} ? '<i class="fa fa-link"></i>' - : '#'). - '</a> '. - '<a class="anchor hidden-xs"'. - "href=\"$content_href\" aria-hidden=\"true\">". - ($ENV{"FA_ICONS"} ? '<i class="fa fa-navicon"></i>' - : 'TOC'). - '</a>'. - '</span>'; + if (defined($heading_level)) { + my $heading = $self->command_text($command); + # empty heading corresponds to an empty @top + if ($heading ne '') { + if ($root_commands{$cmdname} + and $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 .= '<span class="pull-right">'. + '<a class="anchor hidden-xs" '. + "href=\"$this_href\" aria-hidden=\"true\">". + ($ENV{"FA_ICONS"} ? '<i class="fa fa-link"></i>' + : '#'). + '</a> '. + '<a class="anchor hidden-xs"'. + "href=\"$content_href\" aria-hidden=\"true\">". + ($ENV{"FA_ICONS"} ? '<i class="fa fa-navicon"></i>' + : 'TOC'). + '</a>'. + '</span>'; + } } - } - - my $in_preformatted; - if ($program_version_num >= 7.001090) { - $in_preformatted = $self->in_preformatted_context(); - } else { - $in_preformatted = $self->in_preformatted(); - } - if ($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]; - } - if ($program_version_num >= 7.000000) { - $result .= &{get_formatting_function($self,'format_heading_text')}($self, - $cmdname, [$cmdname], $heading, - $heading_level +$self->get_conf('CHAPTER_HEADER_LEVEL') -1, - $heading_id, $command); + my $in_preformatted; + if ($program_version_num >= 7.001090) { + $in_preformatted = $self->in_preformatted_context(); } else { - $result .= &{get_formatting_function($self,'format_heading_text')}( - $self, $cmdname, $heading, - $heading_level + - $self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command); + $in_preformatted = $self->in_preformatted(); + } + if ($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]; + } + if ($program_version_num >= 7.000000) { + $result .= &{get_formatting_function($self,'format_heading_text')}($self, + $cmdname, [$cmdname], $heading, + $heading_level +$self->get_conf('CHAPTER_HEADER_LEVEL') -1, + $heading_id, $command); + + } else { + $result .= &{get_formatting_function($self,'format_heading_text')}( + $self, $cmdname, $heading, + $heading_level + + $self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command); + } } } } -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
