From patchwork Wed Nov 8 16:53:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Plowman X-Patchwork-Id: 44575 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:f392:b0:181:818d:5e7f with SMTP id qr18csp495125pzb; Wed, 8 Nov 2023 08:53:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHOg273kSc4l0Vs6wxV38Fc13o0TRa7x7+e5Js4aZMzIqp4MFiUJf5uGTnl3trSkUk1V2jN X-Received: by 2002:a17:907:2d27:b0:9c7:59d1:b2ce with SMTP id gs39-20020a1709072d2700b009c759d1b2cemr2109559ejc.5.1699462422614; Wed, 08 Nov 2023 08:53:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699462422; cv=none; d=google.com; s=arc-20160816; b=pu7WA24EzdX7Ichu9oqw7qmut+OZImae4ms5Y2y4Je3Q0QuETE37a1XNL6vxOZCox7 zdC/w8V4of/0JjUv7As/m/79YZQyWIGIoQmRFZhHT6b0n956WMxflYIOT/HQW9oTS6b7 iiZvq3cf851ugwbX7BJl8PbIzw4p51k6wM9IlNhacuHHKhYMJEnf/5wWp45J7exGNIZ1 rRczPCvYyEAsnlRq+zjCwxfzkialYZy2647jk5oJyjrhzlPBLr53bvJHUkduw0mxNpya d/9NT99mU7XU10vk8gGggx7ASm5Mg3a+pq/CwCynMY+4FGxQ2epV1vMq/jF4ofpx3QYM iw5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :in-reply-to:from:references:content-language:user-agent :mime-version:date:message-id:dkim-signature:delivered-to; bh=u4HN+JEajkbCLmBc0UPdFj8leH1nRsBryuQDaaoUgSI=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=z/4GPg7ceGECMldQbptdqqzCZIdB0rqYUL5sHXAMDWNaI6Qc1KIO2vnqh+um7ILCC3 5srwefxfCsESomkAcJVYAEUVgtf9p7LlEF/1riwM3TNNG5Ishz1DJVXaDmdZ7y+jYGvj Ts9r5QQTxgKkdPPstmtipl4nYdjzb1mu7ArvD2O5r8tqo1Q1SJRxQ83ycQJLID1zHh4z 2mDTZxRg5FnTi1m2iZ+OscXty+1ojH/MgiktkcLQYv0haBZJI0114omNZnrMohZyVHOo kQeDNtKmNTCCcYvphFDA3gy1OgzH9QQ8k6h3TeKJ9Xlx1GUQy7PNuO4eLepHHzlRo5ta 9jDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@frankplowman.com header.s=s1 header.b=cZyzAphJ; 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 21-20020a170906101500b009e2c4592150si1517303ejm.810.2023.11.08.08.53.41; Wed, 08 Nov 2023 08:53:42 -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=cZyzAphJ; 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 BAA8C68CB18; Wed, 8 Nov 2023 18:53:37 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from s.wrqvwxzv.outbound-mail.sendgrid.net (s.wrqvwxzv.outbound-mail.sendgrid.net [149.72.154.232]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6114C68C83C for ; Wed, 8 Nov 2023 18:53:29 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=frankplowman.com; h=content-type:mime-version:subject:references:from:in-reply-to:to:cc: content-type:from:subject:to; s=s1; bh=Lw/3o8MNU2Kv2DeTbIB0siLxtVUqTbq2fTQ9YQaE/Fo=; b=cZyzAphJGCKrytYz/4xltfhrLCPme1xVGhPwgwjlbunPNRs2Gb1SpScTreftAWioG9I5 gL5+NLGMDF9Xn9NtG6bDk212//95YjZzrnwkZJQOkHCXTsM8nWAcbE3LHO8wzvZ7ct3fGY CcfpE/QbAesP4/9DVoZR2aRQPtLA/y0nzWnJZqd55UHawEuPTyTGzzNUgHrtAknOcUeThq NVBwQA6nz+V4zQVyntLe31n7lZejq9FJvIEhOuDn3jQmuh2TjKolfmScndIImm1rShuP2m SisK8bLa/2FpcgcJDhfLDbBWEv/HiLdewBZ7v1/VdLYeXA8XuTczeMFsouHV0kEw== Received: by filterdrecv-d585b8d85-xmdl8 with SMTP id filterdrecv-d585b8d85-xmdl8-1-654BBD06-38 2023-11-08 16:53:27.13304221 +0000 UTC m=+1690575.519662781 Received: from [10.0.0.6] (unknown) by geopod-ismtpd-7 (SG) with ESMTP id JqMmb5d6QLmhMk3ZFgmezA for ; Wed, 08 Nov 2023 16:53:26.494 +0000 (UTC) Message-ID: <421dcb67-c57d-4cda-83bb-bee2a724c6d3@frankplowman.com> Date: Wed, 08 Nov 2023 16:53:27 +0000 (UTC) MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-GB References: From: Frank Plowman In-Reply-To: X-SG-EID: Uj3aYg52c+LLQjRSx2kNrre9PZxeM4UYymiuV7D/DFCrUPtmdddVVDUZk3miaVh1/JO1FFHK2V1NQv9+VwRIHCCKl/WhaVRp6YNyRsBCcZ3ofg/9RgJSUGxGASbqQIWk/txDponcDAPQcKpNrYNjZCrc6w6SA1+ErJ9rL6jxa1IOQ3OekfgSt7nJOgqkg4sxCL39A/dlzC33pXDgIRLEshhIvyoa7+T5lJ33ERVqDA2cboH03UWLeHiswuCluHWU To: ffmpeg-devel@ffmpeg.org X-Entity-ID: LpPALsXh5JN/Quf2dstifQ== X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [FFmpeg-devel] [PATCH v3] doc/html: 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Mt3/lytEkC1N Patches attached. Changes since v2: * Split changes to t2h.pm and bootstrap.min.css into separate commits. * Add justification for CSS changes to commit message. From 9eac4d40a8ac0683328e4728f69a4fbf68de8080 Mon Sep 17 00:00:00 2001 From: Frank Plowman Date: Wed, 8 Nov 2023 07:55:18 +0000 Subject: [PATCH 1/2] doc/html: Support texinfo 7.0 Resolves #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 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. 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 --- 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 --- a/doc/t2h.pm +++ b/doc/t2h.pm @@ -20,8 +20,45 @@ # 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}; + } +} + +# determine texinfo version +my $program_version_num = version->declare(ff_get_conf('PACKAGE_VERSION'))->numify; +my $program_version_6_8 = $program_version_num >= 6.008000; + # no navigation elements -set_from_init_file('HEADERS', 0); +ff_set_from_init_file('HEADERS', 0); sub ffmpeg_heading_command($$$$$) { @@ -55,7 +92,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,7 +149,11 @@ sub ffmpeg_heading_command($$$$$) $cmdname = $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level]; } - $result .= &{$self->{'format_heading_text'}}( + # format_heading_text expects an array of headings for texinfo >= 7.0 + if ($program_version_num >= 7.000000) { + $heading = [$heading]; + } + $result .= &{get_formatting_function($self,'format_heading_text')}( $self, $cmdname, $heading, $heading_level + $self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command); @@ -126,23 +167,19 @@ foreach my $command (keys(%Texinfo::Common::sectioning_commands), 'node') { texinfo_register_command_formatting($command, \&ffmpeg_heading_command); } -# determine if texinfo is at least version 6.8 -my $program_version_num = version->declare(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 +196,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 +271,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 +292,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 +310,14 @@ sub ffmpeg_float($$$$$) my $args = shift; my $content = shift; - my ($caption, $prepended) = Texinfo::Common::float_name_caption($self, - $command); + my ($caption, $prepended); + if ($program_version_num >= 7.000000) { + ($caption, $prepended) = Texinfo::Convert::Converter::float_name_caption($self, + $command); + } else { + ($caption, $prepended) = Texinfo::Common::float_name_caption($self, + $command); + } my $caption_text = ''; my $prepended_text; my $prepended_save = ''; @@ -335,8 +389,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 +408,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',