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 (%in_heading_spec_commands


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Common.pm (%in_heading_spec_commands), tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/ParserNonXS.pm: rename %in_heading_commands as %in_heading_spec_commands.
Date: Fri, 30 Sep 2022 10:13:03 -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 5f3241f5ad * tp/Texinfo/Common.pm (%in_heading_spec_commands), 
tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/ParserNonXS.pm: rename 
%in_heading_commands as %in_heading_spec_commands.
5f3241f5ad is described below

commit 5f3241f5ad72688ca901a72ac4009fa8135b4807
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Sep 30 16:12:53 2022 +0200

    * tp/Texinfo/Common.pm (%in_heading_spec_commands),
    tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/ParserNonXS.pm: rename
    %in_heading_commands as %in_heading_spec_commands.
    
    * tp/Texinfo/Convert/HTML.pm (converter_initialize): value is now
    in brace commands.
    
    * tp/Texinfo/ParserNonXS.pm: rename %in_*commands hashes and
    associated commands hashes.
---
 ChangeLog                   | 12 +++++++++
 tp/Texinfo/Common.pm        | 14 +++++-----
 tp/Texinfo/Convert/HTML.pm  |  4 +--
 tp/Texinfo/Convert/LaTeX.pm | 10 +++----
 tp/Texinfo/ParserNonXS.pm   | 66 ++++++++++++++++++++++++---------------------
 5 files changed, 61 insertions(+), 45 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index def6dbdca5..dbf5341513 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2022-09-30  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Common.pm (%in_heading_spec_commands),
+       tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/ParserNonXS.pm: rename
+       %in_heading_commands as %in_heading_spec_commands.
+
+       * tp/Texinfo/Convert/HTML.pm (converter_initialize): value is now
+       in brace commands.
+
+       * tp/Texinfo/ParserNonXS.pm: rename %in_*commands hashes and
+       associated commands hashes.
+
 2022-09-29  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Common.pm, tp/Texinfo/XS/parsetexi/command_data.txt,
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index ab365dab01..02722e633c 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -636,17 +636,17 @@ our %other_commands = (
   'refill'            => 'noarg',     # obsolete
 );
 
-# only valid in heading or footing
-our %in_heading_commands;
+# only valid in heading or footing specifications
+our %in_heading_spec_commands;
 foreach my $in_heading_command ('thischapter', 'thischaptername',
    'thischapternum', 'thissection', 'thissectionname', 'thissectionnum',
    'thisfile', 'thispage', 'thistitle') {
-  $in_heading_commands{$in_heading_command} = 1;
+  $in_heading_spec_commands{$in_heading_command} = 1;
 
   $other_commands{$in_heading_command} = 'noarg';
 }
 
-# %in_heading_commands and @| are only valid in the following @-commands
+# %in_heading_spec_commands and @| are only valid in the following @-commands
 our %heading_spec_commands;
 foreach my $headings_specification_command ('everyheading', 'everyfooting',
   'evenheading', 'evenfooting', 'oddheading', 'oddfooting') {
@@ -1195,7 +1195,7 @@ foreach my $preamble_command ('direnty', 'hyphenation', 
'errormsg',
 
 foreach my $formattable_or_formatted_misc_command (
    keys(%formattable_misc_commands), keys(%formatted_misc_commands),
-        keys(%default_index_commands), keys(%in_heading_commands),
+        keys(%default_index_commands), keys(%in_heading_spec_commands),
         keys(%def_commands)) {
   delete $preamble_commands{$formattable_or_formatted_misc_command};
 }
@@ -3088,8 +3088,8 @@ X<C<%heading_spec_commands>>
 
 @-commands used to specify custom headings, like C<@everyheading>.
 
-=item %in_heading_commands
-X<C<%in_heading_commands>>
+=item %in_heading_spec_commands
+X<C<%in_heading_spec_commands>>
 
 Special @-commands appearing in custom headings, such as C<@thischapter>
 or C<@thistitle>.
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 3f107859d4..647fafd219 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -6990,7 +6990,7 @@ sub converter_initialize($)
   my $customized_commands_conversion
      = Texinfo::Config::GNUT_get_commands_conversion();
   foreach my $command (keys(%misc_commands), keys(%brace_commands),
-     keys (%block_commands), keys(%nobrace_commands), 'value') {
+     keys (%block_commands), keys(%nobrace_commands)) {
     if (exists($customized_commands_conversion->{$command})) {
       $self->{'commands_conversion'}->{$command}
           = $customized_commands_conversion->{$command};
@@ -7010,7 +7010,7 @@ sub converter_initialize($)
   my $customized_commands_open
      = Texinfo::Config::GNUT_get_commands_open();
   foreach my $command (keys(%misc_commands), keys(%brace_commands),
-     keys (%block_commands), keys(%nobrace_commands), 'value') {
+     keys (%block_commands), keys(%nobrace_commands)) {
     if (exists($customized_commands_open->{$command})) {
       $self->{'commands_open'}->{$command}
           = $customized_commands_open->{$command};
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 04994ae62c..8c3bec7c56 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -239,14 +239,14 @@ my %preformatted_code_commands = 
%Texinfo::Common::preformatted_code_commands;
 my %default_index_commands = %Texinfo::Common::default_index_commands;
 my %letter_no_arg_commands = %Texinfo::Common::letter_no_arg_commands;
 my %heading_spec_commands = %Texinfo::Common::heading_spec_commands;
-my %in_heading_commands = %Texinfo::Common::in_heading_commands;
+my %in_heading_spec_commands = %Texinfo::Common::in_heading_spec_commands;
 my %unformatted_brace_command = %Texinfo::Common::unformatted_brace_command;
 
 my %preamble_commands = %Texinfo::Common::preamble_commands;
 
 foreach my $kept_command (keys(%informative_commands),
   keys(%default_index_commands),
-  keys(%in_heading_commands),
+  keys(%in_heading_spec_commands),
   keys(%formattable_misc_commands),
   'indent', 'noindent') {
   $formatted_misc_commands{$kept_command} = 1;
@@ -448,7 +448,7 @@ foreach my $accent_command (keys 
%{$LaTeX_accent_commands{'cmd_math'}}) {
 # not exist in the default case.  it is defined in the pagenote package 
together with
 # \pagename which is page in the default case, but it is unclear if this
 # can be used as a basis for translations
-my %LaTeX_in_heading_commands = (
+my %LaTeX_in_heading_spec_commands = (
   'thischapter' => '\chaptername{} \thechapter{} \chaptertitle{}',
   'thischaptername' => '\chaptertitle{}',
   'thischapternum' => '\thechapter{}',
@@ -3391,8 +3391,8 @@ sub _convert($$)
         $result .= "\\needspace{${need_value}pt}%\n";
       }
       return $result;
-    } elsif ($in_heading_commands{$cmdname}) {
-      $result .= $LaTeX_in_heading_commands{$cmdname};
+    } elsif ($in_heading_spec_commands{$cmdname}) {
+      $result .= $LaTeX_in_heading_spec_commands{$cmdname};
       return $result;
     } elsif ($cmdname eq 'title') {
       my $title_text = _title_font($self, $element);
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index daeaadb219..32a4b96d75 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -261,7 +261,7 @@ my %initialization_overrides = (
   'documentlanguage' => 1,
 );
 
-my %nobrace_commands         = %Texinfo::Common::nobrace_commands;
+my %nobrace_commands          = %Texinfo::Common::nobrace_commands;
 my %line_commands             = %Texinfo::Common::line_commands;
 my %other_commands            = %Texinfo::Common::other_commands;
 my %brace_commands            = %Texinfo::Common::brace_commands;
@@ -283,7 +283,7 @@ my %command_index             = 
%Texinfo::Common::command_index;
 my %ref_commands              = %Texinfo::Common::ref_commands;
 my %region_commands           = %Texinfo::Common::region_commands;
 my %heading_spec_commands     = %Texinfo::Common::heading_spec_commands;
-my %in_heading_commands       = %Texinfo::Common::in_heading_commands;
+my %in_heading_spec_commands  = %Texinfo::Common::in_heading_spec_commands;
 my %in_index_commands         = %Texinfo::Common::in_index_commands;
 my %explained_commands        = %Texinfo::Common::explained_commands;
 my %inline_format_commands    = %Texinfo::Common::inline_format_commands;
@@ -378,18 +378,19 @@ foreach my $block_command (keys(%block_commands)) {
 }
 
 # commands that may appear in accents
-my %in_accent_commands = %accent_commands;
+my %in_plain_text_commands = %accent_commands;
 foreach my $brace_command(keys(%brace_commands)) {
-  $in_accent_commands{$brace_command} = 1
+  $in_plain_text_commands{$brace_command} = 1
      if ($brace_commands{$brace_command} eq 'noarg');
 }
 foreach my $no_brace_command (keys(%nobrace_commands)) {
-  $in_accent_commands{$no_brace_command} = 1;
+  $in_plain_text_commands{$no_brace_command} = 1;
 }
-$in_accent_commands{'c'} = 1;
-$in_accent_commands{'comment'} = 1;
+$in_plain_text_commands{'c'} = 1;
+$in_plain_text_commands{'comment'} = 1;
 
-# commands that may appear in text arguments
+# commands that may appear in any text argument, similar constraints
+# as in paragraphs.
 my %in_full_text_commands;
 foreach my $command (keys(%brace_commands), keys(%nobrace_commands)) {
   $in_full_text_commands{$command} = 1;
@@ -410,32 +411,34 @@ foreach my $block_command (keys(%block_commands)) {
     if ($block_commands{$block_command} eq 'conditional');
 }
 
-
 # commands that may appear inside sectioning commands
-my %in_full_line_commands_no_refs = %in_full_text_commands;
-foreach my $not_in_full_line_commands_no_refs ('titlefont',
+my %in_simple_text_with_refs_commands = %in_full_text_commands;
+foreach my $not_in_simple_text_with_refs_commands ('titlefont',
                                    'anchor', 'footnote', 'verb') {
-  delete $in_full_line_commands_no_refs{$not_in_full_line_commands_no_refs};
+  delete 
$in_simple_text_with_refs_commands{$not_in_simple_text_with_refs_commands};
 }
 
 # commands that may happen in simple text arguments
-my %in_simple_text_commands = %in_full_line_commands_no_refs;
+my %in_simple_text_commands = %in_simple_text_with_refs_commands;
 foreach my $not_in_simple_text_command('xref', 'ref', 'pxref', 'inforef') {
   delete $in_simple_text_commands{$not_in_simple_text_command};
 }
 
-my %in_simple_text_headings_commands = (%in_simple_text_commands,
-                                        %in_heading_commands);
+my %in_heading_spec_simple_text_commands = (%in_simple_text_commands,
+                                            %in_heading_spec_commands);
 
-# should not appear in any line command except for heading commands.
+# @this* commands should not appear in any line command except for
+# page heading specification commands but can appear in brace @-commands,
+# on heading specification commands lines, such as indicatric @-commands.
 # Therefore they are set here, such that they do not end up in
-# %in_full_line_commands_no_refs.  Alternatively they could have been
+# %in_simple_text_with_refs_commands.  Alternatively they could have been
 # put in %in_full_text_commands and then removed as
-# $not_in_full_line_commands_no_refs.
-foreach my $in_full_text_no_in_simple_text (keys(%in_heading_commands)) {
-  $in_full_text_commands{$in_full_text_no_in_simple_text} = 1;
+# $not_in_simple_text_with_refs_commands.
+foreach my $in_full_text_not_in_simple_text (keys(%in_heading_spec_commands)) {
+  $in_full_text_commands{$in_full_text_not_in_simple_text} = 1;
 }
 
+
 # commands that only accept simple text as argument in any context.
 my %simple_text_commands;
 foreach my $line_command(keys(%line_commands)) {
@@ -449,10 +452,10 @@ foreach my $line_command(keys(%line_commands)) {
   }
 }
 
-my %simple_text_headings_commands = (%heading_spec_commands);
+my %simple_text_heading_spec_commands = (%heading_spec_commands);
 
-my %full_line_commands_no_refs = (%sectioning_heading_commands,
-                                  %def_commands);
+my %simple_text_with_refs_commands = (%sectioning_heading_commands,
+                                      %def_commands);
 
 delete $simple_text_commands{'center'};
 delete $simple_text_commands{'exdent'};
@@ -464,6 +467,7 @@ foreach my $command (keys (%brace_commands)) {
   }
 }
 
+# %brace_commands 'context'
 foreach my $command ('shortcaption', 'math') {
   $simple_text_commands{$command} = 1;
 }
@@ -496,19 +500,19 @@ $full_line_commands{'itemx'} = 1;
 my %default_valid_nestings;
 
 foreach my $command (keys(%accent_commands)) {
-  $default_valid_nestings{$command} = \%in_accent_commands;
+  $default_valid_nestings{$command} = \%in_plain_text_commands;
 }
 foreach my $command (keys(%simple_text_commands)) {
   $default_valid_nestings{$command} = \%in_simple_text_commands;
 }
-foreach my $command (keys(%simple_text_headings_commands)) {
-  $default_valid_nestings{$command} = \%in_simple_text_headings_commands;
+foreach my $command (keys(%simple_text_heading_spec_commands)) {
+  $default_valid_nestings{$command} = \%in_heading_spec_simple_text_commands;
 }
 foreach my $command (keys(%full_text_commands), keys(%full_line_commands)) {
   $default_valid_nestings{$command} = \%in_full_text_commands;
 }
-foreach my $command (keys(%full_line_commands_no_refs)) {
-  $default_valid_nestings{$command} = \%in_full_line_commands_no_refs;
+foreach my $command (keys(%simple_text_with_refs_commands)) {
+  $default_valid_nestings{$command} = \%in_simple_text_with_refs_commands;
 }
 
 # Only for block commands with line arguments
@@ -3847,9 +3851,9 @@ sub _check_valid_nesting {
         $invalid_parent = $current->{'parent'}->{'cmdname'};
       }
     } elsif ($self->_top_context() eq 'ct_def'
-      # FIXME instead of hardcoding in_full_line_commands_no_refs
+      # FIXME instead of hardcoding in_simple_text_with_refs_commands
       # it would be better to use the parent command valid_nesting.
-             and !$in_full_line_commands_no_refs{$command}) {
+             and !$in_simple_text_with_refs_commands{$command}) {
       my $def_block = $current;
       while ($def_block->{'parent'}
              and (!$def_block->{'parent'}->{'type'}
@@ -4574,7 +4578,7 @@ sub _process_remaining_on_line($$$$)
       my $misc;
 
       if ($arg_spec eq 'noarg') {
-        if ($in_heading_commands{$command}) {
+        if ($in_heading_spec_commands{$command}) {
           # TODO use a more generic system for check of @-command nesting
           # in command on context stack
           my $top_context_command = $self->_top_context_command();



reply via email to

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