From patchwork Sun Nov 5 13:53:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Plowman X-Patchwork-Id: 44528 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3aa6:b0:181:818d:5e7f with SMTP id d38csp929260pzh; Sun, 5 Nov 2023 05:53:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IFsAukIDODQ7ftDsbPT42ECgevO8H41X8mqRnCZY6JKtcH5vEtlSWVL4iLiTzwIl0HOGxqx X-Received: by 2002:a50:8e08:0:b0:544:978f:bdd9 with SMTP id 8-20020a508e08000000b00544978fbdd9mr525329edw.12.1699192429748; Sun, 05 Nov 2023 05:53:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699192429; cv=none; d=google.com; s=arc-20160816; b=gSsC1r1KBICfla2t+Qh1oULkpPd3AT95VeVuDl7ARENyBTBl5hj20B0/y2K7N0uwNs /1S8/IuPK4ZFozuYGhXq333JpiMshTN08OZbiCUguMU5fp1VrXbOFhU8LVwSdLI5hnnb WGwMTQxunLTK9yOl9XVO7aHxbS0YbnLgd29LhUnO9xkHUqViyidP35MQt15VCzN4D560 4hhu7rvqdfUwzB3Qjxnlq/s8xY7Og8uI9dfBvnS0juiu5NXMzpuFWwJ7v3djiwMxCSof F8CsN5OdrUkZjnRHK7fuz3qNnf0Klg7h54t/1o+mp2UBM2DfCcFBcXT3m4s2ZtSpctCx a/kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:to:mime-version:message-id:date:from :dkim-signature:delivered-to; bh=IWBiSPUqhL6CE9HY8eDjzydON8KxIKOvBfREV1jlmMc=; fh=GABYHefZpsCOOVRn8a1IgmYuOvaCu1oFlwEOjvaxWTE=; b=BKIPHQZ6quc8bkk63dhemfTmnGiUIFmj6ouSKWrXuHX4gjkWS8mLahv1N1h457d5OL l4i4QtbikzBzpm2isGsgtYHOqX6XvbrKK+qG8ZrIoGf9aBiJaLUZnsnXoXzdE/zHqftP nP+u6VhO1H8xjJthrOI1GXPJcPImy/Ab7FhFcVEhUjo0M1hm396nFY+Y74A6u5vBZtOG 7FQiBxXDrLZkvSHOFNcn0582653KaupJg03nm3Q1wW+3ApRt1ltR2lwFrDdrirYNAkVz qqOzhW2oOEZIbqBhSZfqMOuqZrCA1zWZ9KNfw/cpAcbNLdvPRLzcjKYZMwtKkoK5W7Le c3Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@frankplowman.com header.s=s1 header.b=RWAJJ3ve; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=frankplowman.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n11-20020a05640205cb00b0053e78b82865si3244026edx.652.2023.11.05.05.53.49; Sun, 05 Nov 2023 05:53:49 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@frankplowman.com header.s=s1 header.b=RWAJJ3ve; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=frankplowman.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 30D0668CED1; Sun, 5 Nov 2023 15:53:46 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from s.wfbtzhsw.outbound-mail.sendgrid.net (s.wfbtzhsw.outbound-mail.sendgrid.net [159.183.224.105]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1F06168CEBB for ; Sun, 5 Nov 2023 15:53:39 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=frankplowman.com; h=from:subject:mime-version:to:cc:content-type: content-transfer-encoding:cc:content-type:from:subject:to; s=s1; bh=epnooitMcc2Qt3DBxUrYiFspe6jkc4FaakX/dlzX11k=; b=RWAJJ3veKZLX+U3Valu3pEqqXNUsSSvpt06OF3TpIG7pHJsu2fyWHL53nIu4ONJBnQkd 1kciv7TWyYiAouJ5bg6NfFC7pNUoiGZlPH+jlu+zTO6mRUZQUaimw+ca24fBgswnnPgNuA Aq/BNMFhRmsnLEJP9PTH8RJjA3KSZzodC7IY1UBsbTsJ8ol07EFAw6TWiYVqioEFxgHTAd lOn9iTswMsDPqT8w8a4MItBwIY1JzJLq1lgvbVLx0Zysgw6ETyaya+Ip0bYHEpfIQV9HfG kHMK9L+sPdV4tV6Pavz3/xewVWx/x4Am/YK0tXMd6VStXQyVx8uCunEUsjKamOSA== Received: by filterdrecv-6b68c9f446-d5db2 with SMTP id filterdrecv-6b68c9f446-d5db2-1-65479E62-17 2023-11-05 13:53:38.52572942 +0000 UTC m=+1624364.722965322 Received: from localhost.localdomain (unknown) by geopod-ismtpd-7 (SG) with ESMTP id gjygamhHSdaPj4I31pLwMQ Sun, 05 Nov 2023 13:53:38.230 +0000 (UTC) From: post@frankplowman.com Date: Sun, 05 Nov 2023 13:53:38 +0000 (UTC) Message-ID: <20231105135335.85752-1-post@frankplowman.com> X-Mailer: git-send-email 2.42.1 MIME-Version: 1.0 X-SG-EID: c4f4aE1Y0RBySa/irqQxUJWZDkoLQ0t/fkUe34xOGiHFVfHH4r0Me5cmF23Z7zumK523rm24OeoaSNhTEVDt5e8tMHh4NgaE8/5utqcDS5Fuc9AkJJ1S14Ycy8aSWITmZz6AYT2AUSs7UBRuK8OxBTWq3ENXOFwRYXj2K9WPX9iNJ48/qkaqM956QZhh6rhqo/eEU7wQaHvvJtr85TJv7JFusbNc/nJRJq7XUgtX9uw= To: ffmpeg-devel@ffmpeg.org X-Entity-ID: LpPALsXh5JN/Quf2dstifQ== Subject: [FFmpeg-devel] [PATCH] doc/t2h: Support texinfo 7.0 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Frank Plowman Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: rlNuvvZXBtcw From: Frank Plowman 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 --- 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

-set_from_init_file('CHAPTER_HEADER_LEVEL', 2); +ff_set_from_init_file('CHAPTER_HEADER_LEVEL', 2); # Do not add
-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 = < $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 .= ''; } 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 . ''; + if ($program_version_num >= 7.000000) { + return $self->html_attribute_class('div', [$html_class]). '>' . "\n" . + $prepended_text . $caption_text . $content . ''; + } else { + return $self->_attribute_class('div', [$html_class]). '>' . "\n" . + $prepended_text . $caption_text . $content . ''; + } } texinfo_register_command_formatting('float',