texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Wed, 8 Mar 2023 15:05:33 -0500 (EST)

branch: master
commit 4e7ac9576b72ca684526b68f88a4c375c2a65369
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Mar 8 21:05:20 2023 +0100

    * tp/Texinfo/Convert/DocBook.pm (_docbook_section_element, _convert),
    tp/Texinfo/Convert/Info.pm (format_node), tp/Texinfo/Convert/LaTeX.pm
    (_associate_other_nodes_to_sections), tp/Texinfo/Structuring.pm
    (set_menus_node_directions), tp/Texinfo/Transformations.pm
    (insert_nodes_for_sectioning_commands): avoid autovivification, and
    use defined() for extra 'normalized' strings that can be '0'.
    
    * tp/Texinfo/Transformations.pm (_new_node): remove/warn about cases
    that cannot happen.
    
    * tp/Texinfo/Convert/Plaintext.pm (_process_text): use $context for
    'var' state too.
---
 ChangeLog                       | 23 +++++++++++++++++++----
 tp/Texinfo/Convert/DocBook.pm   |  9 +++++++--
 tp/Texinfo/Convert/Info.pm      |  5 +++--
 tp/Texinfo/Convert/LaTeX.pm     |  2 +-
 tp/Texinfo/Convert/Plaintext.pm |  3 +--
 tp/Texinfo/Structuring.pm       | 26 ++++++++++++++------------
 tp/Texinfo/Transformations.pm   | 11 +++--------
 7 files changed, 48 insertions(+), 31 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3a847ab17e..2b80d87693 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2023-03-08  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/DocBook.pm (_docbook_section_element, _convert),
+       tp/Texinfo/Convert/Info.pm (format_node), tp/Texinfo/Convert/LaTeX.pm
+       (_associate_other_nodes_to_sections), tp/Texinfo/Structuring.pm
+       (set_menus_node_directions), tp/Texinfo/Transformations.pm
+       (insert_nodes_for_sectioning_commands): avoid autovivification, and
+       use defined() for extra 'normalized' strings that can be '0'.
+
+       * tp/Texinfo/Transformations.pm (_new_node): remove/warn about cases
+       that cannot happen.
+
+       * tp/Texinfo/Convert/Plaintext.pm (_process_text): use $context for 
+       'var' state too.
+
 2023-03-08  Gavin Smith <gavinsmith0123@gmail.com>
 
        * doc/texinfo.texi (Overview): Remove duplicate words.  From
@@ -11,24 +26,24 @@
        name of a subdirectory.  This prevents programs that generate info
        in a pipeline from being confused in weird working directories.
 
-2023-03-07  Patrice Dumas  <pertusus@free.fr>
+2023-03-08  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Makefile.tres, tp/t/info_tests.t: add commands_in_sc
        tp/t/nodenormalization.t: add two more tests, one corresponding to
        commands_in_sc.
 
-2023-03-07  Patrice Dumas  <pertusus@free.fr>
+2023-03-08  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Structuring.pm (set_menus_node_directions): use in-tree
        external menu_entry_node as menu direction.
 
-2023-03-07  Patrice Dumas  <pertusus@free.fr>
+2023-03-08  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (output_internal_links): determine if
        index entry is in code style by checking the associated index
        information, and not the entry information.
 
-2023-03-07  Patrice Dumas  <pertusus@free.fr>
+2023-03-08  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (_prepare_index_entries),
        tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/LaTeX.pm
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index 8c35f89237..d68d580f53 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -562,8 +562,10 @@ sub _docbook_section_element($$)
      = Texinfo::Structuring::section_level_adjusted_command_name($element);
   if ($level_adjusted_cmdname eq 'unnumbered'
       and $element->{'extra'}->{'associated_node'}
+      and $element->{'extra'}->{'associated_node'}->{'extra'}
       and $element->{'extra'}->{'associated_node'}->{'extra'}->{'normalized'}
-      and 
$docbook_special_unnumbered{lc($element->{'extra'}->{'associated_node'}->{'extra'}->{'normalized'})})
 {
+      and $docbook_special_unnumbered{lc(
+           
$element->{'extra'}->{'associated_node'}->{'extra'}->{'normalized'})}) {
     return 
lc($element->{'extra'}->{'associated_node'}->{'extra'}->{'normalized'});
   }
 
@@ -891,7 +893,10 @@ sub _convert($$;$)
               if (! $docbook_special_unnumbered{$docbook_sectioning_element}) {
                 $section_attribute .= " label=\"$label\"";
               }
-              if ($opened_element->{'extra'} and 
$opened_element->{'extra'}->{'associated_node'}) {
+              if ($opened_element->{'extra'}
+                  and $opened_element->{'extra'}->{'associated_node'}
+                  and 
$opened_element->{'extra'}->{'associated_node'}->{'extra'}
+                  and 
defined($opened_element->{'extra'}->{'associated_node'}->{'extra'}->{'normalized'}))
 {
                 $section_attribute
                  .= " 
id=\"$opened_element->{'extra'}->{'associated_node'}->{'extra'}->{'normalized'}\"";
               }
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index 060494e358..890850ed3e 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -493,7 +493,7 @@ sub format_node($$)
                              @{$node_direction->{'extra'}->{'manual_content'}},
                                           {'text' => ')'}]});
       }
-      if ($node_direction->{'extra'}->{'normalized'}) {
+      if (defined($node_direction->{'extra'}->{'normalized'})) {
         my $pre_quote = '';
         my $post_quote = '';
         my ($node_text, $byte_count) = $self->node_line($node_direction);
@@ -518,7 +518,8 @@ sub format_node($$)
         }
         $result .= $pre_quote . $node_text . $post_quote;
       }
-    } elsif ($direction eq 'Up' and $node->{'extra'}->{'normalized'} eq 'Top') 
{
+    } elsif ($direction eq 'Up'
+             and $node->{'extra'}->{'normalized'} eq 'Top') {
       # add an up direction for Top node
       my $text = ",  $direction: ".$self->get_conf('TOP_NODE_UP');
       $self->add_text_to_count($text);
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index e45ae200c0..f57ce77bfa 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -1013,7 +1013,7 @@ sub _associate_other_nodes_to_sections($$)
     if ($element_content->{'cmdname'}
         and $element_content->{'cmdname'} eq 'node') {
       if (not $element_content->{'extra'}->{'associated_section'}
-          and $element_content->{'extra'}->{'normalized'}) {
+          and defined($element_content->{'extra'}->{'normalized'})) {
         if (defined($current_sectioning_command)) {
           $additional_node_section_associations
               ->{$element_content->{'extra'}->{'normalized'}}
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 22a6fce3b5..852dd4e593 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -657,8 +657,7 @@ sub _process_text($$$)
 
   my $text = $command->{'text'};
 
-  if ($context->{'upper_case'}
-      or $self->{'formatters'}[-1]->{'var'}) {
+  if ($context->{'upper_case'} or $context->{'var'}) {
     $text = _protect_sentence_ends($text);
     $text = uc($text);
   }
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index aad026a906..b885ffda17 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -521,17 +521,19 @@ sub set_menus_node_directions($$$$$$)
                       _check_menu_entry($registrar, $customization_information,
                                         $labels, 'menu', $menu_content, $arg);
                     }
-                    # this may happen more than once for a given node if the 
node
-                    # is in more than one menu.  Therefore all the menu up node
-                    # are kept in $menu_node->{'structure'}->{'menu_up_hash'}
-                    $menu_node = $labels->{$arg->{'extra'}->{'normalized'}};
-                    if ($menu_node) {
-                      $menu_node->{'structure'} = {} if 
(!$menu_node->{'structure'});
-                      $menu_node->{'structure'}->{'menu_up'} = $node;
-                      $menu_node->{'structure'}->{'menu_up_hash'} = {}
-                          if (!$menu_node->{'structure'}->{'menu_up_hash'});
-                      $menu_node->{'structure'}->{'menu_up_hash'}
+                    if (defined($arg->{'extra'}->{'normalized'})) {
+                      # this may happen more than once for a given node if the 
node
+                      # is in more than one menu.  Therefore all the menu up 
node
+                      # are kept in $menu_node->{'structure'}->{'menu_up_hash'}
+                      $menu_node = $labels->{$arg->{'extra'}->{'normalized'}};
+                      if ($menu_node) {
+                        $menu_node->{'structure'} = {} if 
(!$menu_node->{'structure'});
+                        $menu_node->{'structure'}->{'menu_up'} = $node;
+                        $menu_node->{'structure'}->{'menu_up_hash'} = {}
+                            if (!$menu_node->{'structure'}->{'menu_up_hash'});
+                        $menu_node->{'structure'}->{'menu_up_hash'}
                                     ->{$node->{'extra'}->{'normalized'}} = 1;
+                      }
                     }
                   } else {
                     $menu_node = $arg;
@@ -1494,8 +1496,8 @@ sub associate_internal_references($$$$$)
       my $normalized =
         Texinfo::Convert::NodeNameNormalization::normalize_node(
             {'contents' => $label_element->{'extra'}->{'node_content'} });
-        $label_element->{'extra'}->{'normalized'} = $normalized
-          if (defined $normalized and $normalized ne '');
+      $label_element->{'extra'}->{'normalized'} = $normalized
+        if (defined($normalized) and $normalized ne '');
     }
 
     if ($ref->{'type'} and $ref->{'type'} eq 'menu_entry_node') {
diff --git a/tp/Texinfo/Transformations.pm b/tp/Texinfo/Transformations.pm
index 37d4eafde5..5a314192a0 100644
--- a/tp/Texinfo/Transformations.pm
+++ b/tp/Texinfo/Transformations.pm
@@ -273,8 +273,7 @@ sub _new_node($$$$)
 
     if ($normalized !~ /[^-]/) {
       if ($appended_number) {
-        # FIXME does not seems to be possible, as there is a trailing number.
-        # Maybe in case of error?
+        warn "BUG: spaces only node name despite appending $appended_number\n";
         return undef;
       } else {
         $node = undef;
@@ -284,11 +283,7 @@ sub _new_node($$$$)
   }
 
   $node->{'extra'}->{'normalized'} = $normalized;
-  # FIXME $node->{'extra'}->{'normalized'} eq '' does not seems to be possible,
-  # as in that case there should be a return undef in the loop.
-  if ($node->{'extra'}->{'normalized'} ne '') {
-    $labels->{$node->{'extra'}->{'normalized'}} = $node;
-  }
+  $labels->{$node->{'extra'}->{'normalized'}} = $node;
   Texinfo::Common::register_label($targets_list, $node);
   push @{$nodes_list}, $node;
   return $node;
@@ -379,7 +374,7 @@ sub insert_nodes_for_sectioning_commands($$$$)
       if ($content->{'cmdname'}
           and $content->{'cmdname'} eq 'node'
           and $content->{'extra'}
-          and $content->{'extra'}->{'normalized'});
+          and defined($content->{'extra'}->{'normalized'}));
     push @contents, $content;
   }
   return (\@contents, \@added_nodes);



reply via email to

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