diff mbox series

[FFmpeg-devel] doc/t2h: Support texinfo 7.0

Message ID 20231105135335.85752-1-post@frankplowman.com
State New
Headers show
Series [FFmpeg-devel] doc/t2h: Support texinfo 7.0 | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Frank Plowman Nov. 5, 2023, 1:53 p.m. UTC
From: Frank Plowman <post@frankplowman.com>

Texinfo 7.0, released in November 2022, changed the names of various
functions. Compiling docs with Texinfo 7.0 results in warnings and
improperly formatted documentation. More old names appear to have
been removed in Texinfo 7.1, released October 2023, which causes docs
compilation to fail.

This PR addresses the issue by adding logic to switch between the old
and new function names depending on the Texinfo version.

CC
https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1938238.html
https://bugs.gentoo.org/916104

Signed-off-by: Frank Plowman <post@frankplowman.com>
---
 doc/t2h.pm | 97 +++++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 78 insertions(+), 19 deletions(-)

Comments

Stefano Sabatini Nov. 5, 2023, 9:01 p.m. UTC | #1
On date Sunday 2023-11-05 13:53:38 +0000, post@frankplowman.com wrote:
> From: Frank Plowman <post@frankplowman.com>
> 
> Texinfo 7.0, released in November 2022, changed the names of various
> functions. Compiling docs with Texinfo 7.0 results in warnings and
> improperly formatted documentation. More old names appear to have
> been removed in Texinfo 7.1, released October 2023, which causes docs
> compilation to fail.
> 
> This PR addresses the issue by adding logic to switch between the old
> and new function names depending on the Texinfo version.
> 
> CC
> https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1938238.html
> https://bugs.gentoo.org/916104
> 
> Signed-off-by: Frank Plowman <post@frankplowman.com>
> ---
>  doc/t2h.pm | 97 +++++++++++++++++++++++++++++++++++++++++++-----------
>  1 file changed, 78 insertions(+), 19 deletions(-)
> 
> diff --git a/doc/t2h.pm b/doc/t2h.pm
> index d07d974286..1f23083703 100644
> --- a/doc/t2h.pm
> +++ b/doc/t2h.pm
> @@ -20,8 +20,41 @@
>  # License along with FFmpeg; if not, write to the Free Software
>  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>  
> +# Texinfo 7.0 changed the syntax of various functions.
> +# Provide a shim for older versions.
> +sub ff_set_from_init_file($$) {
> +    my $key = shift;
> +    my $value = shift;
> +    if (exists &{'texinfo_set_from_init_file'}) {
> +        texinfo_set_from_init_file($key, $value);
> +    } else {
> +        set_from_init_file($key, $value);
> +    }
> +}
> +
> +sub ff_get_conf($) {
> +    my $key = shift;
> +    if (exists &{'texinfo_get_conf'}) {
> +        texinfo_get_conf($key);
> +    } else {
> +        get_conf($key);
> +    }
> +}
> +
> +sub get_formatting_function($$) {
> +    my $obj = shift;
> +    my $func = shift;
> +
> +    my $sub = $obj->can('formatting_function');
> +    if ($sub) {
> +        return $obj->formatting_function($func);
> +    } else {
> +        return $obj->{$func};
> +    }
> +}
> +
>  # no navigation elements
> -set_from_init_file('HEADERS', 0);
> +ff_set_from_init_file('HEADERS', 0);
>  
>  sub ffmpeg_heading_command($$$$$)
>  {
> @@ -55,7 +88,7 @@ sub ffmpeg_heading_command($$$$$)
>          $element = $command->{'parent'};
>      }
>      if ($element) {
> -        $result .= &{$self->{'format_element_header'}}($self, $cmdname,
> +        $result .= &{get_formatting_function($self, 'format_element_header')}($self, $cmdname,
>                                                         $command, $element);
>      }
>  
> @@ -112,8 +145,8 @@ sub ffmpeg_heading_command($$$$$)
>                  $cmdname
>                      = $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level];
>              }
> -            $result .= &{$self->{'format_heading_text'}}(
> -                        $self, $cmdname, $heading,
> +            $result .= &{get_formatting_function($self,'format_heading_text')}(
> +                        $self, $cmdname, [$heading],
>                          $heading_level +
>                          $self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command);
>          }
> @@ -127,22 +160,22 @@ foreach my $command (keys(%Texinfo::Common::sectioning_commands), 'node') {
>  }
>  
>  # 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(ff_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');
> +    ff_set_from_init_file('CONTENTS_OUTPUT_LOCATION', 'inline');
>  } else {
> -    set_from_init_file('INLINE_CONTENTS', 1);
> +    ff_set_from_init_file('INLINE_CONTENTS', 1);
>  }
>  
>  # make chapters <h2>
> -set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
> +ff_set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
>  
>  # Do not add <hr>
> -set_from_init_file('DEFAULT_RULE', '');
> -set_from_init_file('BIG_RULE', '');
> +ff_set_from_init_file('DEFAULT_RULE', '');
> +ff_set_from_init_file('BIG_RULE', '');
>  
>  # Customized file beginning
>  sub ffmpeg_begin_file($$$)

> @@ -159,7 +192,18 @@ sub ffmpeg_begin_file($$$)
>      my ($title, $description, $encoding, $date, $css_lines,
>          $doctype, $bodytext, $copying_comment, $after_body_open,
>          $extra_head, $program_and_version, $program_homepage,
> -        $program, $generator) = $self->_file_header_informations($command);
> +        $program, $generator);
> +    if ($program_version_num >= 7.000000) {
> +        ($title, $description, $encoding, $date, $css_lines,
> +         $doctype, $bodytext, $copying_comment, $after_body_open,
> +         $extra_head, $program_and_version, $program_homepage,
> +         $program, $generator) = $self->_file_header_information($command);
> +    } else {
> +        ($title, $description, $encoding, $date, $css_lines,
> +         $doctype, $bodytext, $copying_comment, $after_body_open,
> +         $extra_head, $program_and_version, $program_homepage,
> +         $program, $generator) = $self->_file_header_informations($command);
> +    }

nit: maybe can be refactored a bit to avoid the duplication (but my
perl is rusty and I cannot test with texinfo 7.0):

my $get_header_information_fn = $program_version_num >= 7.000000 ? $self->_file_header_information : $self->_file_header_informations;
my (...) = $get_header_information_fn($command);

[...]

Looks good otherwise, thanks.
Frank Plowman Nov. 6, 2023, 5:31 p.m. UTC | #2
On 05/11/2023 21:01, Stefano Sabatini wrote:

>> @@ -159,7 +192,18 @@ sub ffmpeg_begin_file($$$)
>>       my ($title, $description, $encoding, $date, $css_lines,
>>           $doctype, $bodytext, $copying_comment, $after_body_open,
>>           $extra_head, $program_and_version, $program_homepage,
>> -        $program, $generator) = $self->_file_header_informations($command);
>> +        $program, $generator);
>> +    if ($program_version_num >= 7.000000) {
>> +        ($title, $description, $encoding, $date, $css_lines,
>> +         $doctype, $bodytext, $copying_comment, $after_body_open,
>> +         $extra_head, $program_and_version, $program_homepage,
>> +         $program, $generator) = $self->_file_header_information($command);
>> +    } else {
>> +        ($title, $description, $encoding, $date, $css_lines,
>> +         $doctype, $bodytext, $copying_comment, $after_body_open,
>> +         $extra_head, $program_and_version, $program_homepage,
>> +         $program, $generator) = $self->_file_header_informations($command);
>> +    }
> nit: maybe can be refactored a bit to avoid the duplication (but my
> perl is rusty and I cannot test with texinfo 7.0):
>
> my $get_header_information_fn = $program_version_num >= 7.000000 ? $self->_file_header_information : $self->_file_header_informations;
> my (...) = $get_header_information_fn($command);
>
> [...]

I've just had a little fiddle to try get this working, and unfortunately 
it looks like while you can create references to normal subroutines, you 
can't easily bind to object methods in Perl. There are some workarounds 
(see 
https://stackoverflow.com/questions/47077879/perl-pass-object-method-reference-as-parameter-to-function), 
but imo they are less readable.

This is the first Perl I've ever written so if any wizards out there 
know a better way please let me know and I'd be happy to put together a v2.

> Looks good otherwise, thanks.
> _______________________________________________
>
Cheers,
Frank
Gyan Doshi Nov. 6, 2023, 6:18 p.m. UTC | #3
On 2023-11-05 07:23 pm, post@frankplowman.com wrote:
> From: Frank Plowman <post@frankplowman.com>
>
> Texinfo 7.0, released in November 2022, changed the names of various
> functions. Compiling docs with Texinfo 7.0 results in warnings and
> improperly formatted documentation. More old names appear to have
> been removed in Texinfo 7.1, released October 2023, which causes docs
> compilation to fail.
>
> This PR addresses the issue by adding logic to switch between the old
> and new function names depending on the Texinfo version.

I can confirm that this silences the compilation warnings and produces 
well rendered HTML with texinfo 7.0.
Can't review the perl code though.

Regards,
Gyan



>
> CC
> https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1938238.html
> https://bugs.gentoo.org/916104
>
> Signed-off-by: Frank Plowman <post@frankplowman.com>
> ---
>   doc/t2h.pm | 97 +++++++++++++++++++++++++++++++++++++++++++-----------
>   1 file changed, 78 insertions(+), 19 deletions(-)
>
> diff --git a/doc/t2h.pm b/doc/t2h.pm
> index d07d974286..1f23083703 100644
> --- a/doc/t2h.pm
> +++ b/doc/t2h.pm
> @@ -20,8 +20,41 @@
>   # License along with FFmpeg; if not, write to the Free Software
>   # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>   
> +# Texinfo 7.0 changed the syntax of various functions.
> +# Provide a shim for older versions.
> +sub ff_set_from_init_file($$) {
> +    my $key = shift;
> +    my $value = shift;
> +    if (exists &{'texinfo_set_from_init_file'}) {
> +        texinfo_set_from_init_file($key, $value);
> +    } else {
> +        set_from_init_file($key, $value);
> +    }
> +}
> +
> +sub ff_get_conf($) {
> +    my $key = shift;
> +    if (exists &{'texinfo_get_conf'}) {
> +        texinfo_get_conf($key);
> +    } else {
> +        get_conf($key);
> +    }
> +}
> +
> +sub get_formatting_function($$) {
> +    my $obj = shift;
> +    my $func = shift;
> +
> +    my $sub = $obj->can('formatting_function');
> +    if ($sub) {
> +        return $obj->formatting_function($func);
> +    } else {
> +        return $obj->{$func};
> +    }
> +}
> +
>   # no navigation elements
> -set_from_init_file('HEADERS', 0);
> +ff_set_from_init_file('HEADERS', 0);
>   
>   sub ffmpeg_heading_command($$$$$)
>   {
> @@ -55,7 +88,7 @@ sub ffmpeg_heading_command($$$$$)
>           $element = $command->{'parent'};
>       }
>       if ($element) {
> -        $result .= &{$self->{'format_element_header'}}($self, $cmdname,
> +        $result .= &{get_formatting_function($self, 'format_element_header')}($self, $cmdname,
>                                                          $command, $element);
>       }
>   
> @@ -112,8 +145,8 @@ sub ffmpeg_heading_command($$$$$)
>                   $cmdname
>                       = $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level];
>               }
> -            $result .= &{$self->{'format_heading_text'}}(
> -                        $self, $cmdname, $heading,
> +            $result .= &{get_formatting_function($self,'format_heading_text')}(
> +                        $self, $cmdname, [$heading],
>                           $heading_level +
>                           $self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command);
>           }
> @@ -127,22 +160,22 @@ foreach my $command (keys(%Texinfo::Common::sectioning_commands), 'node') {
>   }
>   
>   # 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(ff_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');
> +    ff_set_from_init_file('CONTENTS_OUTPUT_LOCATION', 'inline');
>   } else {
> -    set_from_init_file('INLINE_CONTENTS', 1);
> +    ff_set_from_init_file('INLINE_CONTENTS', 1);
>   }
>   
>   # make chapters <h2>
> -set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
> +ff_set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
>   
>   # Do not add <hr>
> -set_from_init_file('DEFAULT_RULE', '');
> -set_from_init_file('BIG_RULE', '');
> +ff_set_from_init_file('DEFAULT_RULE', '');
> +ff_set_from_init_file('BIG_RULE', '');
>   
>   # Customized file beginning
>   sub ffmpeg_begin_file($$$)
> @@ -159,7 +192,18 @@ sub ffmpeg_begin_file($$$)
>       my ($title, $description, $encoding, $date, $css_lines,
>           $doctype, $bodytext, $copying_comment, $after_body_open,
>           $extra_head, $program_and_version, $program_homepage,
> -        $program, $generator) = $self->_file_header_informations($command);
> +        $program, $generator);
> +    if ($program_version_num >= 7.000000) {
> +        ($title, $description, $encoding, $date, $css_lines,
> +         $doctype, $bodytext, $copying_comment, $after_body_open,
> +         $extra_head, $program_and_version, $program_homepage,
> +         $program, $generator) = $self->_file_header_information($command);
> +    } else {
> +        ($title, $description, $encoding, $date, $css_lines,
> +         $doctype, $bodytext, $copying_comment, $after_body_open,
> +         $extra_head, $program_and_version, $program_homepage,
> +         $program, $generator) = $self->_file_header_informations($command);
> +    }
>   
>       my $links = $self->_get_links ($filename, $element);
>   
> @@ -223,7 +267,7 @@ if ($program_version_6_8) {
>   sub ffmpeg_end_file($)
>   {
>       my $self = shift;
> -    my $program_string = &{$self->{'format_program_string'}}($self);
> +    my $program_string = &{get_formatting_function($self,'format_program_string')}($self);
>       my $program_text = <<EOT;
>         <p style="font-size: small;">
>           $program_string
> @@ -244,7 +288,7 @@ if ($program_version_6_8) {
>   
>   # Dummy title command
>   # Ignore title. Title is handled through ffmpeg_begin_file().
> -set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1);
> +ff_set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1);
>   sub ffmpeg_title($$$$)
>   {
>       return '';
> @@ -262,8 +306,13 @@ sub ffmpeg_float($$$$$)
>       my $args = shift;
>       my $content = shift;
>   
> -    my ($caption, $prepended) = Texinfo::Common::float_name_caption($self,
> -                                                                $command);
> +    if ($program_version_num >= 7.000000) {
> +        my ($caption, $prepended) = Texinfo::Convert::Converter::float_name_caption($self,
> +                                                                                    $command);
> +    } else {
> +        my ($caption, $prepended) = Texinfo::Common::float_name_caption($self,
> +                                                                        $command);
> +    }
>       my $caption_text = '';
>       my $prepended_text;
>       my $prepended_save = '';
> @@ -335,8 +384,13 @@ sub ffmpeg_float($$$$$)
>               $caption->{'args'}->[0], 'float caption');
>       }
>       if ($prepended_text.$caption_text ne '') {
> -        $prepended_text = $self->_attribute_class('div','float-caption'). '>'
> -                . $prepended_text;
> +        if ($program_version_num >= 7.000000) {
> +            $prepended_text = $self->html_attribute_class('div',['float-caption']). '>'
> +                    . $prepended_text;
> +        } else {
> +            $prepended_text = $self->_attribute_class('div',['float-caption']). '>'
> +                    . $prepended_text;
> +        }
>           $caption_text .= '</div>';
>       }
>       my $html_class = '';
> @@ -349,8 +403,13 @@ sub ffmpeg_float($$$$$)
>           $prepended_text = '';
>           $caption_text   = '';
>       }
> -    return $self->_attribute_class('div', $html_class). '>' . "\n" .
> -        $prepended_text . $caption_text . $content . '</div>';
> +    if ($program_version_num >= 7.000000) {
> +        return $self->html_attribute_class('div', [$html_class]). '>' . "\n" .
> +            $prepended_text . $caption_text . $content . '</div>';
> +    } else {
> +        return $self->_attribute_class('div', [$html_class]). '>' . "\n" .
> +            $prepended_text . $caption_text . $content . '</div>';
> +    }
>   }
>   
>   texinfo_register_command_formatting('float',
Stefano Sabatini Nov. 6, 2023, 11:36 p.m. UTC | #4
On date Sunday 2023-11-05 13:53:38 +0000, post@frankplowman.com wrote:
> From: Frank Plowman <post@frankplowman.com>
> 
> Texinfo 7.0, released in November 2022, changed the names of various
> functions. Compiling docs with Texinfo 7.0 results in warnings and
> improperly formatted documentation. More old names appear to have
> been removed in Texinfo 7.1, released October 2023, which causes docs
> compilation to fail.
> 
> This PR addresses the issue by adding logic to switch between the old
> and new function names depending on the Texinfo version.
> 
> CC
> https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1938238.html
> https://bugs.gentoo.org/916104
> 
> Signed-off-by: Frank Plowman <post@frankplowman.com>
> ---
>  doc/t2h.pm | 97 +++++++++++++++++++++++++++++++++++++++++++-----------
>  1 file changed, 78 insertions(+), 19 deletions(-)
> 
> diff --git a/doc/t2h.pm b/doc/t2h.pm
> index d07d974286..1f23083703 100644
> --- a/doc/t2h.pm
> +++ b/doc/t2h.pm  
[...]
> @@ -112,8 +145,8 @@ sub ffmpeg_heading_command($$$$$)
>                  $cmdname
>                      = $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level];
>              }

> -            $result .= &{$self->{'format_heading_text'}}(
> -                        $self, $cmdname, $heading,
> +            $result .= &{get_formatting_function($self,'format_heading_text')}(

> +                        $self, $cmdname, [$heading],

Are the added [] intended? This is causing rendering of titles as
ARRAYXNNNNN (as Perl is trying to render a dictionary with its address
in place of a string element).  Dropping the [] fixes the issue.
Stefano Sabatini Nov. 6, 2023, 11:38 p.m. UTC | #5
On date Tuesday 2023-11-07 00:36:14 +0100, Stefano Sabatini wrote:
> On date Sunday 2023-11-05 13:53:38 +0000, post@frankplowman.com wrote:
> > From: Frank Plowman <post@frankplowman.com>
> > 
> > Texinfo 7.0, released in November 2022, changed the names of various
> > functions. Compiling docs with Texinfo 7.0 results in warnings and
> > improperly formatted documentation. More old names appear to have
> > been removed in Texinfo 7.1, released October 2023, which causes docs
> > compilation to fail.
> > 
> > This PR addresses the issue by adding logic to switch between the old
> > and new function names depending on the Texinfo version.
> > 
> > CC
> > https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1938238.html
> > https://bugs.gentoo.org/916104
> > 
> > Signed-off-by: Frank Plowman <post@frankplowman.com>
> > ---
> >  doc/t2h.pm | 97 +++++++++++++++++++++++++++++++++++++++++++-----------
> >  1 file changed, 78 insertions(+), 19 deletions(-)
> > 
> > diff --git a/doc/t2h.pm b/doc/t2h.pm
> > index d07d974286..1f23083703 100644
> > --- a/doc/t2h.pm
> > +++ b/doc/t2h.pm  
> [...]
> > @@ -112,8 +145,8 @@ sub ffmpeg_heading_command($$$$$)
> >                  $cmdname
> >                      = $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level];
> >              }
> 
> > -            $result .= &{$self->{'format_heading_text'}}(
> > -                        $self, $cmdname, $heading,
> > +            $result .= &{get_formatting_function($self,'format_heading_text')}(
> 
> > +                        $self, $cmdname, [$heading],
> 
> Are the added [] intended? This is causing rendering of titles as

> ARRAYXNNNNN (as Perl is trying to render a dictionary with its address

Here I meant array in place of dictionary.

> in place of a string element).  Dropping the [] fixes the issue.

I tested with makeinfo 6.8.
diff mbox series

Patch

diff --git a/doc/t2h.pm b/doc/t2h.pm
index d07d974286..1f23083703 100644
--- a/doc/t2h.pm
+++ b/doc/t2h.pm
@@ -20,8 +20,41 @@ 
 # License along with FFmpeg; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
+# Texinfo 7.0 changed the syntax of various functions.
+# Provide a shim for older versions.
+sub ff_set_from_init_file($$) {
+    my $key = shift;
+    my $value = shift;
+    if (exists &{'texinfo_set_from_init_file'}) {
+        texinfo_set_from_init_file($key, $value);
+    } else {
+        set_from_init_file($key, $value);
+    }
+}
+
+sub ff_get_conf($) {
+    my $key = shift;
+    if (exists &{'texinfo_get_conf'}) {
+        texinfo_get_conf($key);
+    } else {
+        get_conf($key);
+    }
+}
+
+sub get_formatting_function($$) {
+    my $obj = shift;
+    my $func = shift;
+
+    my $sub = $obj->can('formatting_function');
+    if ($sub) {
+        return $obj->formatting_function($func);
+    } else {
+        return $obj->{$func};
+    }
+}
+
 # no navigation elements
-set_from_init_file('HEADERS', 0);
+ff_set_from_init_file('HEADERS', 0);
 
 sub ffmpeg_heading_command($$$$$)
 {
@@ -55,7 +88,7 @@  sub ffmpeg_heading_command($$$$$)
         $element = $command->{'parent'};
     }
     if ($element) {
-        $result .= &{$self->{'format_element_header'}}($self, $cmdname,
+        $result .= &{get_formatting_function($self, 'format_element_header')}($self, $cmdname,
                                                        $command, $element);
     }
 
@@ -112,8 +145,8 @@  sub ffmpeg_heading_command($$$$$)
                 $cmdname
                     = $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level];
             }
-            $result .= &{$self->{'format_heading_text'}}(
-                        $self, $cmdname, $heading,
+            $result .= &{get_formatting_function($self,'format_heading_text')}(
+                        $self, $cmdname, [$heading],
                         $heading_level +
                         $self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command);
         }
@@ -127,22 +160,22 @@  foreach my $command (keys(%Texinfo::Common::sectioning_commands), 'node') {
 }
 
 # 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(ff_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');
+    ff_set_from_init_file('CONTENTS_OUTPUT_LOCATION', 'inline');
 } else {
-    set_from_init_file('INLINE_CONTENTS', 1);
+    ff_set_from_init_file('INLINE_CONTENTS', 1);
 }
 
 # make chapters <h2>
-set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
+ff_set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
 
 # Do not add <hr>
-set_from_init_file('DEFAULT_RULE', '');
-set_from_init_file('BIG_RULE', '');
+ff_set_from_init_file('DEFAULT_RULE', '');
+ff_set_from_init_file('BIG_RULE', '');
 
 # Customized file beginning
 sub ffmpeg_begin_file($$$)
@@ -159,7 +192,18 @@  sub ffmpeg_begin_file($$$)
     my ($title, $description, $encoding, $date, $css_lines,
         $doctype, $bodytext, $copying_comment, $after_body_open,
         $extra_head, $program_and_version, $program_homepage,
-        $program, $generator) = $self->_file_header_informations($command);
+        $program, $generator);
+    if ($program_version_num >= 7.000000) {
+        ($title, $description, $encoding, $date, $css_lines,
+         $doctype, $bodytext, $copying_comment, $after_body_open,
+         $extra_head, $program_and_version, $program_homepage,
+         $program, $generator) = $self->_file_header_information($command);
+    } else {
+        ($title, $description, $encoding, $date, $css_lines,
+         $doctype, $bodytext, $copying_comment, $after_body_open,
+         $extra_head, $program_and_version, $program_homepage,
+         $program, $generator) = $self->_file_header_informations($command);
+    }
 
     my $links = $self->_get_links ($filename, $element);
 
@@ -223,7 +267,7 @@  if ($program_version_6_8) {
 sub ffmpeg_end_file($)
 {
     my $self = shift;
-    my $program_string = &{$self->{'format_program_string'}}($self);
+    my $program_string = &{get_formatting_function($self,'format_program_string')}($self);
     my $program_text = <<EOT;
       <p style="font-size: small;">
         $program_string
@@ -244,7 +288,7 @@  if ($program_version_6_8) {
 
 # Dummy title command
 # Ignore title. Title is handled through ffmpeg_begin_file().
-set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1);
+ff_set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1);
 sub ffmpeg_title($$$$)
 {
     return '';
@@ -262,8 +306,13 @@  sub ffmpeg_float($$$$$)
     my $args = shift;
     my $content = shift;
 
-    my ($caption, $prepended) = Texinfo::Common::float_name_caption($self,
-                                                                $command);
+    if ($program_version_num >= 7.000000) {
+        my ($caption, $prepended) = Texinfo::Convert::Converter::float_name_caption($self,
+                                                                                    $command);
+    } else {
+        my ($caption, $prepended) = Texinfo::Common::float_name_caption($self,
+                                                                        $command);
+    }
     my $caption_text = '';
     my $prepended_text;
     my $prepended_save = '';
@@ -335,8 +384,13 @@  sub ffmpeg_float($$$$$)
             $caption->{'args'}->[0], 'float caption');
     }
     if ($prepended_text.$caption_text ne '') {
-        $prepended_text = $self->_attribute_class('div','float-caption'). '>'
-                . $prepended_text;
+        if ($program_version_num >= 7.000000) {
+            $prepended_text = $self->html_attribute_class('div',['float-caption']). '>'
+                    . $prepended_text;
+        } else {
+            $prepended_text = $self->_attribute_class('div',['float-caption']). '>'
+                    . $prepended_text;
+        }
         $caption_text .= '</div>';
     }
     my $html_class = '';
@@ -349,8 +403,13 @@  sub ffmpeg_float($$$$$)
         $prepended_text = '';
         $caption_text   = '';
     }
-    return $self->_attribute_class('div', $html_class). '>' . "\n" .
-        $prepended_text . $caption_text . $content . '</div>';
+    if ($program_version_num >= 7.000000) {
+        return $self->html_attribute_class('div', [$html_class]). '>' . "\n" .
+            $prepended_text . $caption_text . $content . '</div>';
+    } else {
+        return $self->_attribute_class('div', [$html_class]). '>' . "\n" .
+            $prepended_text . $caption_text . $content . '</div>';
+    }
 }
 
 texinfo_register_command_formatting('float',