texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/Common.pm: add code (not active) to


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Common.pm: add code (not active) to check that settable commands are contained in global commands.
Date: Mon, 10 Oct 2022 17:32:26 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new d95bc0c710 * tp/Texinfo/Common.pm: add code (not active) to check that 
settable commands are contained in global commands.
d95bc0c710 is described below

commit d95bc0c7104c51d39800d20b343c03ef7c150f12
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Oct 10 23:32:13 2022 +0200

    * tp/Texinfo/Common.pm: add code (not active) to check
    that settable commands are contained in global commands.
    
    * tp/Texinfo/ParserNonXS.pm: set %global_multiple_commands
    and %global_unique_commands using the corresponding Texinfo::Commands
    hashes.
---
 ChangeLog                 |  9 +++++++++
 tp/TODO                   |  4 ----
 tp/Texinfo/Common.pm      | 51 +++++++++++++++++++++++++++++++++--------------
 tp/Texinfo/ParserNonXS.pm | 18 ++---------------
 4 files changed, 47 insertions(+), 35 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7a4bf6ed0c..8ed843cf9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-10-10  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Common.pm: add code (not active) to check
+       that settable commands are contained in global commands.
+
+       * tp/Texinfo/ParserNonXS.pm: set %global_multiple_commands
+       and %global_unique_commands using the corresponding Texinfo::Commands
+       hashes.
+
 2022-10-10  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (_html_set_pages_files): call
diff --git a/tp/TODO b/tp/TODO
index 7b28791e14..32614de65d 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -10,10 +10,6 @@ This is the todo list for texi2any
 Before next release
 ===================
 
-check same keys for
-global_unique document_settable_unique_at_commands
-global document_settable_multiple_at_commands
-
 Add in_math (for /)?
 
 Bugs
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 54b080249e..7acf634955 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -35,14 +35,17 @@ use File::Spec;
 # for find_encoding, resolve_alias and maybe utf8 related functions
 use Encode;
 
+# debugging
+use Carp qw(cluck confess);
+
+# uncomment to check that settable commands are contained in global commands
+#use List::Compare;
+
 use Locale::Messages;
 
 use Texinfo::Documentlanguages;
 use Texinfo::Commands;
 
-# debugging
-use Carp qw(cluck confess);
-
 require Exporter;
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 @ISA = qw(Exporter);
@@ -142,6 +145,10 @@ our %document_settable_multiple_at_commands = (
   'documentencoding' => 'us-ascii',
   'documentlanguage' => 'en', # or undef?  Documented as en.
                               # --document-language
+  'everyheading'      => undef,
+  'everyfooting'      => undef,
+  'evenheading'       => undef,
+  'evenfooting'       => undef,
   # is N ems in TeX, 0.4 in.
   'exampleindent' => 5,
   'firstparagraphindent' => 'none',
@@ -149,22 +156,22 @@ our %document_settable_multiple_at_commands = (
   'headings' => 'on',
   'kbdinputstyle' => 'distinct',
   'microtype' => 'on',
+  'oddheading'        => undef,
+  'oddfooting'        => undef,
   'paragraphindent' => 3,
   'shortcontents' => 0,
   'summarycontents' => 0,
-  'contents' => undef,
   'urefbreakstyle' => 'after',
   'xrefautomaticsectiontitle' => 'off',
-  'everyheading'      => undef,
-  'everyfooting'      => undef,
-  'evenheading'       => undef,
-  'evenfooting'       => undef,
-  'oddheading'        => undef,
-  'oddfooting'        => undef,
 );
 
 # @-commands that should be unique.  Associated with customization values too.
 our %document_settable_unique_at_commands = (
+  'afivepaper' => undef,
+  'afourpaper' => undef,
+  'afourlatex' => undef,
+  'afourwide' => undef,
+  'bsixpaper' => undef,
   # when passed through a configuration variable, documentdescription
   # should be already formatted for HTML.  There is no default,
   # what is determined to be the title is used if not set.
@@ -181,14 +188,28 @@ our %document_settable_unique_at_commands = (
   'pagesizes' => undef,
   'setchapternewpage' => 'on',
   'setfilename' => undef,
-  'afourpaper' => undef,
-  'afourlatex' => undef,
-  'afourwide' => undef,
-  'afivepaper' => undef,
-  'bsixpaper' => undef,
   'smallbook' => undef,
 );
 
+# check that settable commands are contained in global commands
+# from command_data.txt
+if (0) {
+#if (1) {
+  my @global_unique_settable = keys(%document_settable_unique_at_commands);
+  my @global_unique_commands = 
keys(%Texinfo::Commands::global_unique_commands);
+  my $lcu = List::Compare->new(\@global_unique_settable, 
\@global_unique_commands);
+  if (scalar($lcu->get_unique)) {
+    warn 'BUG: Unique settable not global: '.join(',',$lcu->get_unique)."\n";
+  }
+
+  my @global_multi_settable = keys(%document_settable_multiple_at_commands);
+  my @global_multi_commands = keys(%Texinfo::Commands::global_commands);
+  my $lcm = List::Compare->new(\@global_multi_settable, 
\@global_multi_commands);
+  if (scalar($lcm->get_unique)) {
+    warn 'BUG: Multi settable not global: '.join(',',$lcm->get_unique)."\n";
+  }
+}
+
 # a value corresponds to defaults that are the same for every output format
 # otherwise undef is used
 our %default_converter_command_line_options = (
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 3187c0577c..81ad51804a 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -285,6 +285,8 @@ my %heading_spec_commands     = 
%Texinfo::Commands::heading_spec_commands;
 my %in_heading_spec_commands  = %Texinfo::Commands::in_heading_spec_commands;
 my %variadic_commands         = %Texinfo::Commands::variadic_commands;
 my %default_index_commands    = %Texinfo::Commands::default_index_commands;
+my %global_multiple_commands  = %Texinfo::Commands::global_commands;
+my %global_unique_commands    = %Texinfo::Commands::global_unique_commands;
 
 my %def_map                   = %Texinfo::Common::def_map;
 my %def_aliases               = %Texinfo::Common::def_aliases;
@@ -354,22 +356,6 @@ foreach my $command ('anchor', 'hyphenation', 'caption', 
'shortcaption',
   $command_ignore_space_after{$command} = 1;
 }
 
-my %global_multiple_commands;
-foreach my $global_multiple_command (
-  'footnote', 'hyphenation', 'insertcopying', 'printindex',
-  'subtitle','titlefont', 'listoffloats', 'detailmenu', 'part',
-  keys(%Texinfo::Common::document_settable_multiple_at_commands), ) {
-  $global_multiple_commands{$global_multiple_command} = 1;
-}
-
-my %global_unique_commands;
-foreach my $global_unique_command (
-  'copying', 'settitle',
-  'shorttitlepage', 'title', 'titlepage', 'top',
-  keys(%Texinfo::Common::document_settable_unique_at_commands), ) {
-  $global_unique_commands{$global_unique_command} = 1;
-}
-
 # @-commands that do not start a paragraph
 my %default_no_paragraph_commands;
 # @-commands that should be at the beginning of a line



reply via email to

[Prev in Thread] Current Thread [Next in Thread]