Backported from the below upstream commit.
From f01fdedb69e4accb1d1555106d8f682ff1f1ddc7 Mon Sep 17 00:00:00 2001
From: Frank Plowman <post@frankplowman.com>
Date: Wed, 8 Nov 2023 07:55:18 +0000
Subject: [PATCH 1/1] doc/html: support texinfo 7.0
Resolves trac ticket #10636 (http://trac.ffmpeg.org/ticket/10636).
Texinfo 7.0, released in November 2022, changed the names of various
functions. Compiling docs with Texinfo 7.0 resulted 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 commit addresses the issue by adding logic to switch between the old
and new function names depending on the Texinfo version. Texinfo 6.8
produces identical documentation before and after the patch.
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 | 106 ++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 85 insertions(+), 21 deletions(-)
diff --git a/doc/t2h.pm b/doc/t2h.pm
index d07d974286..b7485e1f1e 100644
|
|
|
20 | 20 | # License along with FFmpeg; if not, write to the Free Software |
21 | 21 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
22 | 22 | |
| 23 | # Texinfo 7.0 changed the syntax of various functions. |
| 24 | # Provide a shim for older versions. |
| 25 | sub ff_set_from_init_file($$) { |
| 26 | my $key = shift; |
| 27 | my $value = shift; |
| 28 | if (exists &{'texinfo_set_from_init_file'}) { |
| 29 | texinfo_set_from_init_file($key, $value); |
| 30 | } else { |
| 31 | set_from_init_file($key, $value); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | sub ff_get_conf($) { |
| 36 | my $key = shift; |
| 37 | if (exists &{'texinfo_get_conf'}) { |
| 38 | texinfo_get_conf($key); |
| 39 | } else { |
| 40 | get_conf($key); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | sub get_formatting_function($$) { |
| 45 | my $obj = shift; |
| 46 | my $func = shift; |
| 47 | |
| 48 | my $sub = $obj->can('formatting_function'); |
| 49 | if ($sub) { |
| 50 | return $obj->formatting_function($func); |
| 51 | } else { |
| 52 | return $obj->{$func}; |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | # determine texinfo version |
| 57 | my $program_version_num = version->declare(ff_get_conf('PACKAGE_VERSION'))->numify; |
| 58 | my $program_version_6_8 = $program_version_num >= 6.008000; |
| 59 | |
23 | 60 | # no navigation elements |
24 | | set_from_init_file('HEADERS', 0); |
| 61 | ff_set_from_init_file('HEADERS', 0); |
25 | 62 | |
26 | 63 | sub ffmpeg_heading_command($$$$$) |
27 | 64 | { |
… |
… |
sub ffmpeg_heading_command($$$$$) |
55 | 92 | $element = $command->{'parent'}; |
56 | 93 | } |
57 | 94 | if ($element) { |
58 | | $result .= &{$self->{'format_element_header'}}($self, $cmdname, |
| 95 | $result .= &{get_formatting_function($self, 'format_element_header')}($self, $cmdname, |
59 | 96 | $command, $element); |
60 | 97 | } |
61 | 98 | |
… |
… |
sub ffmpeg_heading_command($$$$$) |
112 | 149 | $cmdname |
113 | 150 | = $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level]; |
114 | 151 | } |
115 | | $result .= &{$self->{'format_heading_text'}}( |
| 152 | # format_heading_text expects an array of headings for texinfo >= 7.0 |
| 153 | if ($program_version_num >= 7.000000) { |
| 154 | $heading = [$heading]; |
| 155 | } |
| 156 | $result .= &{get_formatting_function($self,'format_heading_text')}( |
116 | 157 | $self, $cmdname, $heading, |
117 | 158 | $heading_level + |
118 | 159 | $self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command); |
… |
… |
foreach my $command (keys(%Texinfo::Common::sectioning |
127 | 168 | } |
128 | 169 | |
129 | 170 | # print the TOC where @contents is used |
130 | | set_from_init_file('INLINE_CONTENTS', 1); |
| 171 | ff_set_from_init_file('INLINE_CONTENTS', 1); |
131 | 172 | |
132 | 173 | # make chapters <h2> |
133 | | set_from_init_file('CHAPTER_HEADER_LEVEL', 2); |
| 174 | ff_set_from_init_file('CHAPTER_HEADER_LEVEL', 2); |
134 | 175 | |
135 | 176 | # Do not add <hr> |
136 | | set_from_init_file('DEFAULT_RULE', ''); |
137 | | set_from_init_file('BIG_RULE', ''); |
| 177 | ff_set_from_init_file('DEFAULT_RULE', ''); |
| 178 | ff_set_from_init_file('BIG_RULE', ''); |
138 | 179 | |
139 | 180 | # Customized file beginning |
140 | 181 | sub ffmpeg_begin_file($$$) |
… |
… |
sub ffmpeg_begin_file($$$) |
151 | 192 | my ($title, $description, $encoding, $date, $css_lines, |
152 | 193 | $doctype, $bodytext, $copying_comment, $after_body_open, |
153 | 194 | $extra_head, $program_and_version, $program_homepage, |
154 | | $program, $generator) = $self->_file_header_informations($command); |
| 195 | $program, $generator); |
| 196 | if ($program_version_num >= 7.000000) { |
| 197 | ($title, $description, $encoding, $date, $css_lines, |
| 198 | $doctype, $bodytext, $copying_comment, $after_body_open, |
| 199 | $extra_head, $program_and_version, $program_homepage, |
| 200 | $program, $generator) = $self->_file_header_information($command); |
| 201 | } else { |
| 202 | ($title, $description, $encoding, $date, $css_lines, |
| 203 | $doctype, $bodytext, $copying_comment, $after_body_open, |
| 204 | $extra_head, $program_and_version, $program_homepage, |
| 205 | $program, $generator) = $self->_file_header_informations($command); |
| 206 | } |
155 | 207 | |
156 | 208 | my $links = $self->_get_links ($filename, $element); |
157 | 209 | |
… |
… |
sub ffmpeg_end_file($) |
207 | 259 | sub ffmpeg_end_file($) |
208 | 260 | { |
209 | 261 | my $self = shift; |
210 | | my $program_string = &{$self->{'format_program_string'}}($self); |
| 262 | my $program_string = &{get_formatting_function($self,'format_program_string')}($self); |
211 | 263 | my $program_text = <<EOT; |
212 | 264 | <p style="font-size: small;"> |
213 | 265 | $program_string |
… |
… |
texinfo_register_formatting_function('end_file', \&ffm |
224 | 276 | |
225 | 277 | # Dummy title command |
226 | 278 | # Ignore title. Title is handled through ffmpeg_begin_file(). |
227 | | set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1); |
| 279 | ff_set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1); |
228 | 280 | sub ffmpeg_title($$$$) |
229 | 281 | { |
230 | 282 | return ''; |
… |
… |
sub ffmpeg_float($$$$$) |
242 | 294 | my $args = shift; |
243 | 295 | my $content = shift; |
244 | 296 | |
245 | | my ($caption, $prepended) = Texinfo::Common::float_name_caption($self, |
246 | | $command); |
| 297 | my ($caption, $prepended); |
| 298 | if ($program_version_num >= 7.000000) { |
| 299 | ($caption, $prepended) = Texinfo::Convert::Converter::float_name_caption($self, |
| 300 | $command); |
| 301 | } else { |
| 302 | ($caption, $prepended) = Texinfo::Common::float_name_caption($self, |
| 303 | $command); |
| 304 | } |
247 | 305 | my $caption_text = ''; |
248 | 306 | my $prepended_text; |
249 | 307 | my $prepended_save = ''; |
… |
… |
sub ffmpeg_float($$$$$) |
315 | 373 | $caption->{'args'}->[0], 'float caption'); |
316 | 374 | } |
317 | 375 | if ($prepended_text.$caption_text ne '') { |
318 | | $prepended_text = $self->_attribute_class('div','float-caption'). '>' |
319 | | . $prepended_text; |
| 376 | if ($program_version_num >= 7.000000) { |
| 377 | $prepended_text = $self->html_attribute_class('div',['float-caption']). '>' |
| 378 | . $prepended_text; |
| 379 | } else { |
| 380 | $prepended_text = $self->_attribute_class('div','float-caption'). '>' |
| 381 | . $prepended_text; |
| 382 | } |
320 | 383 | $caption_text .= '</div>'; |
321 | 384 | } |
322 | 385 | my $html_class = ''; |
… |
… |
sub ffmpeg_float($$$$$) |
329 | 392 | $prepended_text = ''; |
330 | 393 | $caption_text = ''; |
331 | 394 | } |
332 | | return $self->_attribute_class('div', $html_class). '>' . "\n" . |
333 | | $prepended_text . $caption_text . $content . '</div>'; |
| 395 | if ($program_version_num >= 7.000000) { |
| 396 | return $self->html_attribute_class('div', [$html_class]). '>' . "\n" . |
| 397 | $prepended_text . $caption_text . $content . '</div>'; |
| 398 | } else { |
| 399 | return $self->_attribute_class('div', $html_class). '>' . "\n" . |
| 400 | $prepended_text . $caption_text . $content . '</div>'; |
| 401 | } |
334 | 402 | } |
335 | 403 | |
336 | 404 | texinfo_register_command_formatting('float', |