[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ffmpeg documentation no longer builds after Texinfo 7.1 (due to --in
From: |
Arsen Arsenović |
Subject: |
Re: ffmpeg documentation no longer builds after Texinfo 7.1 (due to --init-file=) |
Date: |
Sun, 05 Nov 2023 12:13:00 +0100 |
User-agent: |
mu4e 1.10.7; emacs 30.0.50 |
Patrice Dumas <pertusus@free.fr> writes:
> On Sat, Nov 04, 2023 at 02:39:32PM +0100, Arsen Arsenović wrote:
>> Afternoon,
>>
>> Following changes in Texinfo 7.1 (uncertain which commit - haven't
>> bisected) FFmpeg documentation no longer builds. This is due to an init
>> file (attached). The following is a minimum reproducer:
>>
>> makeinfo --init-file=t2h.pm -o /dev/null /dev/null
>>
>> The result:
>>
>> makeinfo: error parsing t2h.pm: Undefined subroutine
>> &Texinfo::Config::set_from_init_file called at t2h.pm line 24.
>
> When I try to run it from within the texinfo-7.1 sources, I get another
> error. My guess is that the modules that is loaded corresponds to an
> older version which did not have set_from_init_file, or where
> set_from_init_file was called something else.
>
>
> The error I get is:
>
> ~/src/texinfo-7.1/tp$ ./texi2any.pl --init-file=t2h.pm -o /dev/null /dev/null
> texi2any: error parsing ./t2h.pm: Undefined subroutine
> &Texinfo::Config::get_conf called at ./t2h.pm line 130.
>
> That's because since some versions, it is texinfo_get_conf that should
> be used when directly called (not from a converter). From within the
> sources, when called as texi2any.pl, +dev is prepended, so here is how I
> made it work:
>
> my $texinfo_version = texinfo_get_conf('PACKAGE_VERSION');
> $texinfo_version =~ s/\+dev$//;
> # determine if texinfo is at least version 6.8
> my $program_version_num = version->declare($texinfo_version)->numify;
Oh, interesting. On my system, I'm using texinfo built from master, and
it completely lacks PACKAGE_VERSION! (if I rebuild from releases/7.1,
it's present). It looks like it got removed in
6a1a78b941a832033b8939ab4cdce1646dd56904.
Seems that relatively many things changed between 6.x and 7.0. The
following patch managed to get t2h.pm to parse and work correctly
(presumably):
From b5deb61cc257a1b0290f63d446abc29081a9834a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= <arsen@aarsen.me>
Date: Sun, 5 Nov 2023 11:44:46 +0100
Subject: [PATCH] t2h.pm: fix on texinfo >=7.0
Done with a help from Patrice Dumas <pertusus@free.fr>. Thanks!
---
doc/t2h.pm | 61 ++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 43 insertions(+), 18 deletions(-)
diff --git a/doc/t2h.pm b/doc/t2h.pm
index d07d974286..04a8b1ab30 100644
--- a/doc/t2h.pm
+++ b/doc/t2h.pm
@@ -21,7 +21,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# no navigation elements
-set_from_init_file('HEADERS', 0);
+texinfo_set_from_init_file('HEADERS', 0);
sub ffmpeg_heading_command($$$$$)
{
@@ -126,23 +126,35 @@ foreach my $command
(keys(%Texinfo::Common::sectioning_commands), 'node') {
texinfo_register_command_formatting($command, \&ffmpeg_heading_command);
}
+my $texinfo_version = texinfo_get_conf('PACKAGE_VERSION')
+ || texinfo_get_conf('PACKAGE_VERSION_OPTION');
+$texinfo_version =~ s/(\+?dev)*$//;
# 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_version)->numify;
my $program_version_6_8 = $program_version_num >= 6.008000;
+my $program_version_7_0 = $program_version_num >= 7.000000;
# 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 <h2>
-set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
+texinfo_set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
# Do not add <hr>
-set_from_init_file('DEFAULT_RULE', '');
-set_from_init_file('BIG_RULE', '');
+texinfo_set_from_init_file('DEFAULT_RULE', '');
+texinfo_set_from_init_file('BIG_RULE', '');
+
+sub ffmpeg_file_header_info($$)
+{
+ my $self = shift;
+ my $command = shift;
+ return $self->_file_header_information($command) if $program_version_7_0;
+ reutrn $self->_file_header_informations($command);
+}
# Customized file beginning
sub ffmpeg_begin_file($$$)
@@ -159,7 +171,7 @@ 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) = ffmpeg_file_header_info($self, $command);
my $links = $self->_get_links ($filename, $element);
@@ -201,9 +213,9 @@ if ($program_version_6_8) {
sub ffmpeg_program_string($)
{
my $self = shift;
- if (defined($self->get_conf('PROGRAM'))
- and $self->get_conf('PROGRAM') ne ''
- and defined($self->get_conf('PACKAGE_URL'))) {
+ if (defined(texinfo_get_conf('PROGRAM'))
+ and texinfo_get_conf('PROGRAM') ne ''
+ and defined(texinfo_get_conf('PACKAGE_URL'))) {
return $self->convert_tree(
$self->gdt('This document was generated using @uref{{program_homepage},
@emph{{program}}}.',
{ 'program_homepage' => $self->get_conf('PACKAGE_URL'),
@@ -223,7 +235,7 @@ if ($program_version_6_8) {
sub ffmpeg_end_file($)
{
my $self = shift;
- my $program_string = &{$self->{'format_program_string'}}($self);
+ my $program_string =
&{$self->formatting_function('format_program_string')}($self);
my $program_text = <<EOT;
<p style="font-size: small;">
$program_string
@@ -244,7 +256,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);
+texinfo_set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1);
sub ffmpeg_title($$$$)
{
return '';
@@ -253,6 +265,19 @@ sub ffmpeg_title($$$$)
texinfo_register_command_formatting('titlefont',
\&ffmpeg_title);
+# html_attribute_class compat code
+sub ffmpeg_class($$@)
+{
+ my $self = shift;
+ my $element = shift;
+ my @classes = shift;
+ if ($program_version_7_0) {
+ return $self->html_attribute_class($element, \@classes);
+ } else {
+ return $self->_attribute_class($element, join(' ', @classes));
+ }
+}
+
# Customized float command. Part of code borrowed from GNU Texinfo.
sub ffmpeg_float($$$$$)
{
@@ -262,8 +287,8 @@ sub ffmpeg_float($$$$$)
my $args = shift;
my $content = shift;
- my ($caption, $prepended) = Texinfo::Common::float_name_caption($self,
- $command);
+ my ($caption, $prepended) =
Texinfo::Convert::Converter::float_name_caption($self,
+
$command);
my $caption_text = '';
my $prepended_text;
my $prepended_save = '';
@@ -335,8 +360,8 @@ sub ffmpeg_float($$$$$)
$caption->{'args'}->[0], 'float caption');
}
if ($prepended_text.$caption_text ne '') {
- $prepended_text = $self->_attribute_class('div','float-caption'). '>'
- . $prepended_text;
+ $prepended_text = ffmpeg_class($self, 'div', ['float-caption']). '>'
+ . $prepended_text;
$caption_text .= '</div>';
}
my $html_class = '';
@@ -349,7 +374,7 @@ sub ffmpeg_float($$$$$)
$prepended_text = '';
$caption_text = '';
}
- return $self->_attribute_class('div', $html_class). '>' . "\n" .
+ return ffmpeg_class($self, 'div', [$html_class]). '>' . "\n" .
$prepended_text . $caption_text . $content . '</div>';
}
--
2.42.1
Does this patch seem reasonable to you?
Thanks, have a lovely day.
--
Arsen Arsenović
signature.asc
Description: PGP signature