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, tp/Texinfo/Convert/DocBoo


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/TexinfoMarkup.pm, tp/Texinfo/ParserNonXS.pm: remove %context_brace_commands, instead check if brace_commands type is set to context.
Date: Sun, 02 Oct 2022 16:52:58 -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 23bf5e9b46 * tp/Texinfo/Common.pm, tp/Texinfo/Convert/DocBook.pm, 
tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/TexinfoMarkup.pm, 
tp/Texinfo/ParserNonXS.pm: remove %context_brace_commands, instead check if 
brace_commands type is set to context.
23bf5e9b46 is described below

commit 23bf5e9b461cc5e20dccc3b94cd5bd6a5af6a664
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Oct 2 22:52:46 2022 +0200

    * tp/Texinfo/Common.pm, tp/Texinfo/Convert/DocBook.pm,
    tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/TexinfoMarkup.pm,
    tp/Texinfo/ParserNonXS.pm: remove %context_brace_commands, instead
    check if brace_commands type is set to context.
---
 ChangeLog                                |  7 +++++++
 tp/Texinfo/Common.pm                     | 22 +---------------------
 tp/Texinfo/Convert/DocBook.pm            |  4 ++--
 tp/Texinfo/Convert/HTML.pm               |  7 ++++---
 tp/Texinfo/Convert/TexinfoMarkup.pm      | 12 ++++++------
 tp/Texinfo/ParserNonXS.pm                | 22 ++++++++++++----------
 tp/Texinfo/XS/parsetexi/command_data.txt |  1 +
 7 files changed, 33 insertions(+), 42 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 024edaffe5..dc4565f422 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-10-02  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Common.pm, tp/Texinfo/Convert/DocBook.pm,
+       tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/TexinfoMarkup.pm,
+       tp/Texinfo/ParserNonXS.pm: remove %context_brace_commands, instead
+       check if brace_commands type is set to context.
+
 2022-10-02  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Common.pm, tp/Texinfo/ParserNonXS.pm,
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 213c8f0bf1..52a3648d9f 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -520,20 +520,6 @@ foreach my $command ('code', 'command', 'env', 'file', 
'indicateurl', 'kbd',
 # brace style command that are not style code commands
 $brace_code_commands{'verb'} = 1;
 
-# Commands that enclose full texts not in the main document context.
-# They can contain multiple paragraphs.
-our %context_brace_commands;
-foreach my $context_brace_command ('footnote', 'caption',
-    'shortcaption') {
-  $context_brace_commands{$context_brace_command} = $context_brace_command;
-}
-
-# Commands that enclose math content, and, because of that, are not in the
-# main document context.
-foreach my $math_brace_command ('math') {
-  $context_brace_commands{$math_brace_command} = $math_brace_command;
-}
-
 our %explained_commands;
 foreach my $explained_command ('abbr', 'acronym') {
   $explained_commands{$explained_command} = 1;
@@ -1521,7 +1507,7 @@ foreach my $type (@inline_types) {
 }
 
 my %not_inline_commands = (%Texinfo::Commands::root_commands, 
%Texinfo::Commands::block_commands,
-                           %context_brace_commands);
+     grep {$Texinfo::Commands::brace_commands{$_} eq 'context'} 
keys(%Texinfo::Commands::brace_commands));
 
 # Return 1 if inline in a running text, 0 if right in top-level or block
 # environment, and undef otherwise.
@@ -2645,12 +2631,6 @@ X<C<%brace_code_commands>>
 Brace commands that have their argument in code style, like
 C<@code>.
 
-=item %context_brace_commands
-X<C<%context_brace_commands>>
-
-@-commands with brace like C<@footnote>, C<@caption> and C<@math>
-whose argument is outside of the main text flow in one way or another.
-
 =item %def_commands
 
 =item %def_aliases
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index 6a26f850a1..736fca24ca 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -963,7 +963,7 @@ sub _convert($$;$)
              and 
exists($Texinfo::Commands::brace_commands{$element->{'cmdname'}})) {
       #Texinfo::Common::debug_list(" brace command with args", 
$element->{'args'});
       if ($style_commands_formatting{$element->{'cmdname'}}) {
-        if ($Texinfo::Common::context_brace_commands{$element->{'cmdname'}}) {
+        if ($Texinfo::Commands::brace_commands{$element->{'cmdname'}} eq 
'context') {
           push (@{$self->{'document_context'}},
                 {'monospace' => [0], 'upper_case' => [0]});
         }
@@ -1002,7 +1002,7 @@ sub _convert($$;$)
         }
         pop @{$self->{'document_context'}->[-1]->{'monospace'}}
           if (defined($in_monospace_not_normal));
-        if ($Texinfo::Common::context_brace_commands{$element->{'cmdname'}}) {
+        if ($Texinfo::Commands::brace_commands{$element->{'cmdname'}} eq 
'context') {
           pop @{$self->{'document_context'}};
         }
         if ($element->{'cmdname'} eq 'w') {
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 656f64d85c..619d71c4e3 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -108,7 +108,6 @@ my %preformatted_commands = 
%Texinfo::Commands::preformatted_commands;
 my %math_commands = %Texinfo::Commands::math_commands;
 my %preformatted_code_commands = 
%Texinfo::Commands::preformatted_code_commands;
 
-my %context_brace_commands = %Texinfo::Common::context_brace_commands;
 my %letter_no_arg_commands = %Texinfo::Common::letter_no_arg_commands;
 
 my %formatted_line_commands = %Texinfo::Common::formatted_line_commands;
@@ -10152,7 +10151,8 @@ sub _convert($$;$)
     }
     if (exists($self->{'commands_conversion'}->{$command_name})) {
       my $convert_to_latex;
-      if (exists($context_brace_commands{$command_name})) {
+      if (exists($brace_commands{$command_name})
+          and $brace_commands{$command_name} eq 'context') {
         $self->_new_document_context($command_name);
       }
       if (exists($format_context_commands{$command_name})) {
@@ -10309,7 +10309,8 @@ sub _convert($$;$)
       if (exists($format_context_commands{$command_name})) {
         pop @{$self->{'document_context'}->[-1]->{'formatting_context'}};
       }
-      if (exists($context_brace_commands{$command_name})) {
+      if (exists($brace_commands{$command_name})
+          and $brace_commands{$command_name} eq 'context') {
         $self->_pop_document_context();
       }
 
diff --git a/tp/Texinfo/Convert/TexinfoMarkup.pm 
b/tp/Texinfo/Convert/TexinfoMarkup.pm
index 9d0efbcffc..2bb85c071a 100644
--- a/tp/Texinfo/Convert/TexinfoMarkup.pm
+++ b/tp/Texinfo/Convert/TexinfoMarkup.pm
@@ -1025,11 +1025,11 @@ sub _convert($$;$)
         # element for the first argument
         @format_elements = ($element->{'cmdname'});
         # leading spaces are directly associated to the @-command for @-command
-        # in context_brace_commands
+        # in context brace_commands
         push @$attribute, _leading_spaces_arg($element);
       }
 
-      if ($Texinfo::Common::context_brace_commands{$element->{'cmdname'}}) {
+      if ($Texinfo::Commands::brace_commands{$element->{'cmdname'}} eq 
'context') {
         push @{$self->{'document_context'}}, {'monospace' => [0]};
       }
       my $last_empty_element;
@@ -1037,7 +1037,7 @@ sub _convert($$;$)
       my $arg_index = 0;
       foreach my $format_element (@format_elements) {
         if (defined($element->{'args'}->[$arg_index])) {
-          # Leading spaces are gathered here except for context_brace_commands
+          # Leading spaces are gathered here except for context brace_commands
           # (gathered just above).
           push @$attribute,
             _leading_spaces_arg($element->{'args'}->[$arg_index]);
@@ -1087,7 +1087,7 @@ sub _convert($$;$)
       if ($last_empty_element) {
         $args_or_one_arg_cmd .= $last_empty_element;
       }
-      if ($Texinfo::Common::context_brace_commands{$element->{'cmdname'}}) {
+      if ($Texinfo::Commands::brace_commands{$element->{'cmdname'}} eq 
'context') {
         pop @{$self->{'document_context'}};
       }
       if (not defined($main_cmdname)) {
@@ -1148,9 +1148,9 @@ sub _convert($$;$)
         }
       }
       # this never happens as there is no @-commands with more than one
-      # argument that is also a context_brace_commands.  Leading spaces
+      # argument that is also a context brace_commands.  Leading spaces
       # after the command brace opening are only associated with command
-      # if a context_brace_commands, therefore they are with the first 
argument.
+      # if a context brace_commands, therefore they are with the first 
argument.
       push @$attribute, _leading_spaces_arg($element);
       return $self->txi_markup_open_element($main_cmdname, $attribute)
                  
.$args_or_one_arg_cmd.$self->txi_markup_close_element($main_cmdname);
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 06d1104a4c..b70cc742e3 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -207,9 +207,9 @@ my %parser_default_configuration = (
 #                         (html, xml, docbook...)
 #                         'ct_inlineraw' is added when in inlineraw
 #                         'ct_brace_command' is added when in footnote,
-#                         caption, or shortcaption (in %context_brace_commands
+#                         caption, or shortcaption (context brace_commands
 #                         that does not already start another context, ie not
-#                         not math).
+#                         math).
 # context_command_stack   the stack of @-commands. An @-command name can
 #                         be added each time a context is pushed on
 #                         'context_stack'.  Could be undef if there
@@ -1471,8 +1471,8 @@ sub _close_all_style_commands($$$;$$)
       $interrupting_command) = @_;
 
   while ($current->{'parent'} and $current->{'parent'}->{'cmdname'}
-          and exists 
$self->{'brace_commands'}->{$current->{'parent'}->{'cmdname'}}
-          and !exists 
$context_brace_commands{$current->{'parent'}->{'cmdname'}}) {
+          and 
exists($self->{'brace_commands'}->{$current->{'parent'}->{'cmdname'}})
+          and $self->{'brace_commands'}->{$current->{'parent'}->{'cmdname'}} 
ne 'context') {
     print STDERR "CLOSING(_close_all_style_commands) 
\@$current->{'parent'}->{'cmdname'}\n"
          if ($self->{'DEBUG'});
     $current = _close_brace_command($self, $current->{'parent'}, $source_info,
@@ -1841,7 +1841,7 @@ sub _close_current($$$;$$)
     print STDERR "CLOSING(_close_current) \@$current->{'cmdname'}\n"
          if ($self->{'DEBUG'});
     if (exists($self->{'brace_commands'}->{$current->{'cmdname'}})) {
-      if (exists $context_brace_commands{$current->{'cmdname'}}) {
+      if ($self->{'brace_commands'}->{$current->{'cmdname'}} eq 'context') {
         my $expected_context;
         if ($math_commands{$current->{'cmdname'}}) {
           $expected_context = 'ct_math';
@@ -1938,7 +1938,7 @@ sub _close_commands($$$;$$)
          and not ($current->{'type'}
                   and $current->{'type'} eq 'before_node_section')
      # Stop if in a root command
-     # or in a context_brace_commands and searching for a specific
+     # or in a context brace_commands and searching for a specific
      # end block command (with $closed_block_command set).
      # This second condition means that a footnote is not closed when
      # looking for the end of a block command, but is closed when
@@ -1946,7 +1946,8 @@ sub _close_commands($$$;$$)
          and !($current->{'cmdname'}
                and ($root_commands{$current->{'cmdname'}}
                     or ($closed_block_command and 
$current->{'parent'}->{'cmdname'}
-                       and 
$context_brace_commands{$current->{'parent'}->{'cmdname'}})))){
+                       and 
(exists($brace_commands{$current->{'parent'}->{'cmdname'}})
+            and $brace_commands{$current->{'parent'}->{'cmdname'}} eq 
'context'))))) {
     _close_command_cleanup($self, $current);
     $current = _close_current($self, $current, $source_info, 
$closed_block_command,
                               $interrupting_command);
@@ -5257,7 +5258,7 @@ sub _process_remaining_on_line($$$$)
         }
 
         $current = $current->{'args'}->[-1];
-        if ($context_brace_commands{$command}) {
+        if ($self->{'brace_commands'}->{$command} eq 'context') {
           if ($command eq 'caption' or $command eq 'shortcaption') {
             my $float;
             if (!$current->{'parent'}->{'parent'}
@@ -5382,7 +5383,7 @@ sub _process_remaining_on_line($$$$)
           and $current->{'parent'}->{'cmdname'}
           and exists 
$self->{'brace_commands'}->{$current->{'parent'}->{'cmdname'}}) {
         # for math and footnote out of paragraph
-        if ($context_brace_commands{$current->{'parent'}->{'cmdname'}}) {
+        if ($self->{'brace_commands'}->{$current->{'parent'}->{'cmdname'}} eq 
'context') {
           my $command_context = 'ct_brace_command';
           if ($math_commands{$current->{'parent'}->{'cmdname'}}) {
             $command_context = 'ct_math';
@@ -5600,7 +5601,8 @@ sub _process_remaining_on_line($$$$)
          $current = _end_paragraph($self, $current, $source_info);
          if ($current->{'parent'}
              and $current->{'parent'}->{'cmdname'}
-             and $context_brace_commands{$current->{'parent'}->{'cmdname'}}) {
+             and $self->{'brace_commands'}
+                  ->{$current->{'parent'}->{'cmdname'}} eq 'context') {
           $self->_pop_context(['ct_brace_command'], $source_info, $current,
                      "for brace isolated $current->{'parent'}->{'cmdname'}");
           print STDERR "CLOSING(context command) 
\@$current->{'parent'}->{'cmdname'}\n"
diff --git a/tp/Texinfo/XS/parsetexi/command_data.txt 
b/tp/Texinfo/XS/parsetexi/command_data.txt
index b6cba57075..fa2f615642 100644
--- a/tp/Texinfo/XS/parsetexi/command_data.txt
+++ b/tp/Texinfo/XS/parsetexi/command_data.txt
@@ -381,6 +381,7 @@ dmn                     brace,contain_plain_text        
BRACE_other         1
 titlefont               brace,global                    BRACE_other         1
 
 # context brace commands - commands that enclose full texts
+# not in the main document context.  They can contain multiple paragraphs.
 footnote                brace,global                    BRACE_context
 caption                 brace                           BRACE_context
 shortcaption            brace                           BRACE_context



reply via email to

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