texinfo-commits
[Top][All Lists]
Advanced

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

[7457] reduce use of normalized


From: gavinsmith0123
Subject: [7457] reduce use of normalized
Date: Sun, 16 Oct 2016 18:13:14 +0000 (UTC)

Revision: 7457
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7457
Author:   gavin
Date:     2016-10-16 18:13:14 +0000 (Sun, 16 Oct 2016)
Log Message:
-----------
reduce use of normalized

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/Texinfo/Convert/Info.pm
    trunk/tp/Texinfo/Convert/Plaintext.pm

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2016-10-16 17:52:46 UTC (rev 7456)
+++ trunk/ChangeLog     2016-10-16 18:13:14 UTC (rev 7457)
@@ -1,5 +1,19 @@
 2016-10-16  Gavin Smith  <address@hidden>
 
+       * tp/Texinfo/Convert/Info.pm (output) <anchors and nodes>,
+       (_node): Don't refer to 'normalized' value on an element defining an
+       xref target; use 'node_content' instead.
+       (output) <anchors and nodes>: Convert the anchor with _node_line
+       to check for duplicates, instead of using the 'normalized' value.
+       * tp/Texinfo/Convert/Plaintext.pm:
+       Remove "use Texinfo::Convert::NodeNameNormalization".
+       (_footnotes): Don't set 'normalized' on the elements we create
+       representing footnote anchors.
+       (_convert) <float>: Use 'node_content' instead of 'normalized'
+       to check if this float should be an anchor.
+
+2016-10-16  Gavin Smith  <address@hidden>
+
        * tp/Texinfo/Convert/Plaintext.pm (_convert): For 'float'
        elements, change check on 'content' value back to check on 
        'normalized' value on 'type' hash.

Modified: trunk/tp/Texinfo/Convert/Info.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Info.pm    2016-10-16 17:52:46 UTC (rev 7456)
+++ trunk/tp/Texinfo/Convert/Info.pm    2016-10-16 18:13:14 UTC (rev 7457)
@@ -237,25 +237,28 @@
   # This may happen for anchors in @insertcopying
   my %seen_anchors;
   foreach my $label (@{$self->{'count_context'}->[-1]->{'locations'}}) {
-    next unless ($label->{'root'} and $label->{'root'}->{'extra'} 
-                  and defined($label->{'root'}->{'extra'}->{'normalized'}));
+    next unless ($label->{'root'} and $label->{'root'}->{'extra'}
+                   and defined($label->{'root'}->{'extra'}->{'node_content'}));
     my $prefix;
+    
     if ($label->{'root'}->{'cmdname'} eq 'node') {
       $prefix = 'Node';
     } else {
-      if ($seen_anchors{$label->{'root'}->{'extra'}->{'normalized'}}) {
-        $self->line_error(sprintf($self->__("address@hidden output more than 
once: %s"),
-                       $label->{'root'}->{'cmdname'},
-                 Texinfo::Convert::Texinfo::convert({'contents' =>
-                      $label->{'root'}->{'extra'}->{'node_content'}})),
-                      $label->{'root'}->{'line_nr'});
-        next;
-      } else {
-        $seen_anchors{$label->{'root'}->{'extra'}->{'normalized'}} = $label;
-      }
       $prefix = 'Ref';
     }
     my ($label_text, $byte_count) = $self->_node_line($label->{'root'});
+
+    if ($seen_anchors{$label_text}) {
+      $self->line_error(sprintf($self->__("address@hidden output more than 
once: %s"),
+          $label->{'root'}->{'cmdname'},
+          Texinfo::Convert::Texinfo::convert({'contents' =>
+              $label->{'root'}->{'extra'}->{'node_content'}})),
+        $label->{'root'}->{'line_nr'});
+      next;
+    } else {
+      $seen_anchors{$label_text} = 1;
+    }
+
     $tag_text .=  "$prefix: $label_text\x{7F}$label->{'bytes'}\n";
   }
   $tag_text .=  "\x{1F}\nEnd Tag Table\n";
@@ -388,7 +391,7 @@
   my $node = shift;
   
   my $result = '';
-  return '' if (!defined($node->{'extra'}->{'normalized'}));
+  return '' if (!defined($node->{'extra'}->{'node_content'}));
   if (!$self->{'empty_lines_count'}) {
     $result .= "\n";
     $self->_add_text_count("\n");

Modified: trunk/tp/Texinfo/Convert/Plaintext.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Plaintext.pm       2016-10-16 17:52:46 UTC (rev 
7456)
+++ trunk/tp/Texinfo/Convert/Plaintext.pm       2016-10-16 18:13:14 UTC (rev 
7457)
@@ -35,7 +35,6 @@
 use Texinfo::Convert::Text;
 use Texinfo::Convert::Line;
 use Texinfo::Convert::UnFilled;
-use Texinfo::Convert::NodeNameNormalization;
 
 
 use Carp qw(cluck);
@@ -872,14 +871,10 @@
 
       my $node_contents = 
address@hidden>{'extra'}->{'node'}->{'extra'}->{'node_content'}},
                                      {'text' => '-Footnotes'}];
-      my $normalized
-        = Texinfo::Convert::NodeNameNormalization::normalize_node(
-                                                {'contents' => 
$node_contents});
       my $footnotes_node = {
         'cmdname' => 'node',
         'node_up' => $element->{'extra'}->{'node'},
-        'extra' => {'node_content' => $node_contents,
-                    'normalized' => $normalized}
+        'extra' => {'node_content' => $node_contents }
       };
       $result .= $self->_node($footnotes_node);
       $self->{'node'} = $footnotes_node;
@@ -895,11 +890,8 @@
       if ($element) {
         my $node_contents = 
address@hidden>{'extra'}->{'node'}->{'extra'}->{'node_content'}},
                     {'text' => "-Footnote-$footnote->{'number'}"}];
-        my $normalized 
-          = 
Texinfo::Convert::NodeNameNormalization::normalize_node({'contents' => 
$node_contents});
         $self->_add_location({'cmdname' => 'anchor',
-                        'extra' => {'node_content' => $node_contents,
-                                    'normalized' => $normalized}
+                        'extra' => {'node_content' => $node_contents }
                        });
       }
       # this pushes on 'context', 'formatters', 'format_context',
@@ -2530,7 +2522,7 @@
         $self->{'document_context'}->[-1]->{'in_multitable'}++;
       } elsif ($root->{'cmdname'} eq 'float') {
         $result .= _add_newline_if_needed($self);
-        if ($root->{'extra'} and $root->{'extra'}->{'normalized'}) {
+        if ($root->{'extra'} and $root->{'extra'}->{'node_content'}) {
           $result .= $self->_anchor($root);
         }
       }




reply via email to

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