<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">diff --git doc/t2h.pm doc/t2h.pm
index b7485e1f1e..1359960f27 100644
--- doc/t2h.pm
+++ doc/t2h.pm
@@ -54,12 +54,24 @@ sub get_formatting_function($$) {
 }
 
 # determine texinfo version
-my $program_version_num = version-&gt;declare(ff_get_conf('PACKAGE_VERSION'))-&gt;numify;
+my $package_version = ff_get_conf('PACKAGE_VERSION');
+$package_version =~ s/\+dev$//;
+my $program_version_num = version-&gt;declare($package_version)-&gt;numify;
 my $program_version_6_8 = $program_version_num &gt;= 6.008000;
 
 # no navigation elements
 ff_set_from_init_file('HEADERS', 0);
 
+my %sectioning_commands = %Texinfo::Common::sectioning_commands;
+if (scalar(keys(%sectioning_commands)) == 0) {
+  %sectioning_commands = %Texinfo::Commands::sectioning_heading_commands;
+}
+
+my %root_commands = %Texinfo::Common::root_commands;
+if (scalar(keys(%root_commands)) == 0) {
+  %root_commands = %Texinfo::Commands::root_commands;
+}
+
 sub ffmpeg_heading_command($$$$$)
 {
     my $self = shift;
@@ -77,6 +89,9 @@ sub ffmpeg_heading_command($$$$$)
         return $result;
     }
 
+    # no need to set it as the $element_id is output unconditionally
+    my $heading_id;
+
     my $element_id = $self-&gt;command_id($command);
     $result .= "&lt;a name=\"$element_id\"&gt;&lt;/a&gt;\n"
         if (defined($element_id) and $element_id ne '');
@@ -84,24 +99,40 @@ sub ffmpeg_heading_command($$$$$)
     print STDERR "Process $command "
         .Texinfo::Structuring::_print_root_command_texi($command)."\n"
             if ($self-&gt;get_conf('DEBUG'));
-    my $element;
-    if ($Texinfo::Common::root_commands{$command-&gt;{'cmdname'}}
-        and $command-&gt;{'parent'}
-        and $command-&gt;{'parent'}-&gt;{'type'}
-        and $command-&gt;{'parent'}-&gt;{'type'} eq 'element') {
-        $element = $command-&gt;{'parent'};
+    my $output_unit;
+    if ($root_commands{$command-&gt;{'cmdname'}}) {
+        if ($command-&gt;{'associated_unit'}) {
+          $output_unit = $command-&gt;{'associated_unit'};
+        } elsif ($command-&gt;{'structure'}
+                 and $command-&gt;{'structure'}-&gt;{'associated_unit'}) {
+          $output_unit = $command-&gt;{'structure'}-&gt;{'associated_unit'};
+        } elsif ($command-&gt;{'parent'}
+                 and $command-&gt;{'parent'}-&gt;{'type'}
+                 and $command-&gt;{'parent'}-&gt;{'type'} eq 'element') {
+          $output_unit = $command-&gt;{'parent'};
+        }
     }
-    if ($element) {
+
+    if ($output_unit) {
         $result .= &amp;{get_formatting_function($self, 'format_element_header')}($self, $cmdname,
-                                                       $command, $element);
+                                                       $command, $output_unit);
     }
 
     my $heading_level;
     # node is used as heading if there is nothing else.
     if ($cmdname eq 'node') {
-        if (!$element or (!$element-&gt;{'extra'}-&gt;{'section'}
-            and $element-&gt;{'extra'}-&gt;{'node'}
-            and $element-&gt;{'extra'}-&gt;{'node'} eq $command
+        if (!$output_unit or
+            (((!$output_unit-&gt;{'extra'}-&gt;{'section'}
+              and $output_unit-&gt;{'extra'}-&gt;{'node'}
+              and $output_unit-&gt;{'extra'}-&gt;{'node'} eq $command)
+             or
+             ((($output_unit-&gt;{'extra'}-&gt;{'unit_command'}
+                and $output_unit-&gt;{'extra'}-&gt;{'unit_command'} eq $command)
+               or
+               ($output_unit-&gt;{'unit_command'}
+                and $output_unit-&gt;{'unit_command'} eq $command))
+              and $command-&gt;{'extra'}
+              and not $command-&gt;{'extra'}-&gt;{'associated_section'}))
              # bogus node may not have been normalized
             and defined($command-&gt;{'extra'}-&gt;{'normalized'}))) {
             if ($command-&gt;{'extra'}-&gt;{'normalized'} eq 'Top') {
@@ -111,7 +142,15 @@ sub ffmpeg_heading_command($$$$$)
             }
         }
     } else {
-        $heading_level = $command-&gt;{'level'};
+        if (defined($command-&gt;{'extra'})
+            and defined($command-&gt;{'extra'}-&gt;{'section_level'})) {
+          $heading_level = $command-&gt;{'extra'}-&gt;{'section_level'};
+        } elsif ($command-&gt;{'structure'}
+                 and defined($command-&gt;{'structure'}-&gt;{'section_level'})) {
+          $heading_level = $command-&gt;{'structure'}-&gt;{'section_level'};
+        } else {
+          $heading_level = $command-&gt;{'level'};
+        }
     }
 
     my $heading = $self-&gt;command_text($command);
@@ -119,8 +158,8 @@ sub ffmpeg_heading_command($$$$$)
     # 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}) {
+        if ($root_commands{$cmdname}
+            and $sectioning_commands{$cmdname}) {
             my $content_href = $self-&gt;command_contents_href($command, 'contents',
                                                             $self-&gt;{'current_filename'});
             if ($content_href) {
@@ -140,7 +179,13 @@ sub ffmpeg_heading_command($$$$$)
             }
         }
 
-        if ($self-&gt;in_preformatted()) {
+        my $in_preformatted;
+        if ($program_version_num &gt;= 7.001090) {
+          $in_preformatted = $self-&gt;in_preformatted_context();
+        } else {
+          $in_preformatted = $self-&gt;in_preformatted();
+        }
+        if ($in_preformatted) {
             $result .= $heading."\n";
         } else {
             # if the level was changed, set the command name right
@@ -149,21 +194,25 @@ sub ffmpeg_heading_command($$$$$)
                 $cmdname
                     = $Texinfo::Common::level_to_structuring_command{$cmdname}-&gt;[$heading_level];
             }
-            # format_heading_text expects an array of headings for texinfo &gt;= 7.0
             if ($program_version_num &gt;= 7.000000) {
-                $heading = [$heading];
-            }
-            $result .= &amp;{get_formatting_function($self,'format_heading_text')}(
+                $result .= &amp;{get_formatting_function($self,'format_heading_text')}($self,
+                     $cmdname, [$cmdname], $heading,
+                     $heading_level +$self-&gt;get_conf('CHAPTER_HEADER_LEVEL') -1,
+                     $heading_id, $command);
+
+            } else {
+              $result .= &amp;{get_formatting_function($self,'format_heading_text')}(
                         $self, $cmdname, $heading,
                         $heading_level +
                         $self-&gt;get_conf('CHAPTER_HEADER_LEVEL') - 1, $command);
+            }
         }
     }
     $result .= $content if (defined($content));
     return $result;
 }
 
-foreach my $command (keys(%Texinfo::Common::sectioning_commands), 'node') {
+foreach my $command (keys(%sectioning_commands), 'node') {
     texinfo_register_command_formatting($command, \&amp;ffmpeg_heading_command);
 }
 
@@ -188,28 +237,56 @@ sub ffmpeg_begin_file($$$)
     my $filename = shift;
     my $element = shift;
 
-    my $command;
-    if ($element and $self-&gt;get_conf('SPLIT')) {
-        $command = $self-&gt;element_command($element);
+    my ($element_command, $node_command, $command_for_title);
+    if ($element) {
+        if ($element-&gt;{'unit_command'}) {
+          $element_command = $element-&gt;{'unit_command'};
+        } elsif ($self-&gt;can('tree_unit_element_command')) {
+          $element_command = $self-&gt;tree_unit_element_command($element);
+        } elsif ($self-&gt;can('tree_unit_element_command')) {
+          $element_command = $self-&gt;element_command($element);
+        }
+
+       $node_command = $element_command;
+       if ($element_command and $element_command-&gt;{'cmdname'}
+           and $element_command-&gt;{'cmdname'} ne 'node'
+           and $element_command-&gt;{'extra'}
+           and $element_command-&gt;{'extra'}-&gt;{'associated_node'}) {
+         $node_command = $element_command-&gt;{'extra'}-&gt;{'associated_node'};
+       }
+
+       $command_for_title = $element_command if ($self-&gt;get_conf('SPLIT'));
     }
 
-    my ($title, $description, $encoding, $date, $css_lines,
-        $doctype, $bodytext, $copying_comment, $after_body_open,
-        $extra_head, $program_and_version, $program_homepage,
+    my ($title, $description, $keywords, $encoding, $date, $css_lines, $doctype,
+        $root_html_element_attributes, $body_attributes, $copying_comment,
+        $after_body_open, $extra_head, $program_and_version, $program_homepage,
         $program, $generator);
-    if ($program_version_num &gt;= 7.000000) {
-        ($title, $description, $encoding, $date, $css_lines,
-         $doctype, $bodytext, $copying_comment, $after_body_open,
+    if ($program_version_num &gt;= 7.001090) {
+        ($title, $description, $keywords, $encoding, $date, $css_lines, $doctype,
+         $root_html_element_attributes, $body_attributes, $copying_comment,
+         $after_body_open, $extra_head, $program_and_version, $program_homepage,
+         $program, $generator) = $self-&gt;_file_header_information($command_for_title,
+                                                                 $filename); 
+    } elsif ($program_version_num &gt;= 7.000000) {
+        ($title, $description, $encoding, $date, $css_lines, $doctype,
+         $root_html_element_attributes, $copying_comment, $after_body_open,
          $extra_head, $program_and_version, $program_homepage,
-         $program, $generator) = $self-&gt;_file_header_information($command);
+         $program, $generator) = $self-&gt;_file_header_information($command_for_title,
+                                                                 $filename);
     } else {
         ($title, $description, $encoding, $date, $css_lines,
-         $doctype, $bodytext, $copying_comment, $after_body_open,
-         $extra_head, $program_and_version, $program_homepage,
-         $program, $generator) = $self-&gt;_file_header_informations($command);
+         $doctype, $root_html_element_attributes, $copying_comment,
+         $after_body_open, $extra_head, $program_and_version, $program_homepage,
+         $program, $generator) = $self-&gt;_file_header_informations($command_for_title);
     }
 
-    my $links = $self-&gt;_get_links ($filename, $element);
+    my $links;
+    if ($program_version_num &gt;= 7.000000) {
+      $links = $self-&gt;_get_links($filename, $element, $node_command);
+    } else {
+      $links = $self-&gt;_get_links ($filename, $element);
+    }
 
     my $head1 = $ENV{"FFMPEG_HEADER1"} || &lt;&lt;EOT;
 &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
@@ -252,13 +329,25 @@ sub ffmpeg_program_string($)
   if (defined($self-&gt;get_conf('PROGRAM'))
       and $self-&gt;get_conf('PROGRAM') ne ''
       and defined($self-&gt;get_conf('PACKAGE_URL'))) {
-    return $self-&gt;convert_tree(
+    if ($program_version_num &gt;= 7.001090) {
+     return $self-&gt;convert_tree(
+      $self-&gt;cdt('This document was generated using @uref{{program_homepage}, @emph{{program}}}.',
+         { 'program_homepage' =&gt; {'text' =&gt; $self-&gt;get_conf('PACKAGE_URL')},
+           'program' =&gt; {'text' =&gt; $self-&gt;get_conf('PROGRAM') }}));
+    } else {
+     return $self-&gt;convert_tree(
       $self-&gt;gdt('This document was generated using @uref{{program_homepage}, @emph{{program}}}.',
-         { 'program_homepage' =&gt; $self-&gt;get_conf('PACKAGE_URL'),
-           'program' =&gt; $self-&gt;get_conf('PROGRAM') }));
+         { 'program_homepage' =&gt; {'text' =&gt; $self-&gt;get_conf('PACKAGE_URL')},
+           'program' =&gt; {'text' =&gt; $self-&gt;get_conf('PROGRAM') }}));
+    }
   } else {
-    return $self-&gt;convert_tree(
-      $self-&gt;gdt('This document was generated automatically.'));
+    if ($program_version_num &gt;= 7.001090) {
+      return $self-&gt;convert_tree(
+        $self-&gt;cdt('This document was generated automatically.'));
+    } else {
+      return $self-&gt;convert_tree(
+        $self-&gt;gdt('This document was generated automatically.'));
+    }
   }
 }
 if ($program_version_6_8) {
</pre></body></html>