texinfo-commits
[Top][All Lists]
Advanced

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

[7436] remove indent_menu_descriptions


From: gavinsmith0123
Subject: [7436] remove indent_menu_descriptions
Date: Sat, 8 Oct 2016 10:27:01 +0000 (UTC)

Revision: 7436
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7436
Author:   gavin
Date:     2016-10-08 10:27:00 +0000 (Sat, 08 Oct 2016)
Log Message:
-----------
remove indent_menu_descriptions

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/Texinfo/Convert/Converter.pm
    trunk/tp/Texinfo/Convert/Plaintext.pm
    trunk/tp/texi2any.pl

Removed Paths:
-------------
    trunk/tp/t/indent_menu_descriptions.t

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2016-10-06 20:15:54 UTC (rev 7435)
+++ trunk/ChangeLog     2016-10-08 10:27:00 UTC (rev 7436)
@@ -1,3 +1,23 @@
+2016-10-08  Gavin Smith  <address@hidden>
+
+       * tp/Texinfo/Convert/Plaintext.pm
+       (indent_menu_descriptions, indent_one_menu_descriptions):
+       Remove.  This feature has not worked in any released version of 
+       Texinfo due to calling 'indent_menu_descriptions' (itself) 
+       instead of 'indent_one_menu_descriptions'.  This also simplifies
+       matters, as the 'menus' list for each node is not used anywhere
+       else in the modules under tp/Texinfo/Convert/.
+       * tp/texi2any.pl: Don't call indent_menu_descriptions if 
+       'indent_menu_descriptions' was present in TREE_TRANSFORMATIONS.
+       * tp/t/indent_menu_descriptions.t: Remove.
+       * doc/texinfo.texi (Other Customization Variables) 
+       <TREE_TRANSFORMATIONS>: Remove mention of 'indent_menu_descriptions'
+       feature.
+       <TEXINFO_COLUMN_FOR_DESCRIPTION>: Remove mention.
+       * tp/Texinfo/Converter/Converter.pm (%all_converters_defaults),
+       * tp/Texinfo/Converter/Common.pm (@variable_string_settables):
+       Remove 'TEXINFO_COLUMN_FOR_DESCRIPTION'.
+
 2016-10-06  Gavin Smith  <address@hidden>
 
        * info/nodes.c (build_tag_table): Check if node name in tag table

Modified: trunk/tp/Texinfo/Convert/Converter.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Converter.pm       2016-10-06 20:15:54 UTC (rev 
7435)
+++ trunk/tp/Texinfo/Convert/Converter.pm       2016-10-08 10:27:00 UTC (rev 
7436)
@@ -101,7 +101,6 @@
   'DEBUG'                => 0,
   'TEST'                 => 0,
   'translated_commands'  => {'error' => 'address@hidden',},
-  'TEXINFO_COLUMN_FOR_DESCRIPTION' => 32, # same as emacs
 );
 
 # For translation of in document string.

Modified: trunk/tp/Texinfo/Convert/Plaintext.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Plaintext.pm       2016-10-06 20:15:54 UTC (rev 
7435)
+++ trunk/tp/Texinfo/Convert/Plaintext.pm       2016-10-08 10:27:00 UTC (rev 
7436)
@@ -3416,101 +3416,6 @@
   return $result;
 }
 
-sub indent_one_menu_descriptions($$)
-{
-  my $self = shift;
-  my $menu = shift;
-
-  foreach my $content (@{$menu->{'contents'}}) {
-    if ($content->{'type'} and $content->{'type'} eq 'menu_entry') {
-      my $result = '';
-      my $node_seen = 0;
-      foreach my $arg (@{$content->{'args'}}) {
-        if ($arg->{'type'} eq 'menu_entry_node') {
-          $result .= $self->_convert({'type' => '_code',
-                                      'contents' => $arg->{'contents'}});
-          $node_seen = 1;
-        } else {
-          # the separator appearing after the node is modified
-          if ($arg->{'type'} eq 'menu_entry_separator' and $node_seen) {
-            $arg->{'text'} =~ s/\s*$//;
-          }
-          $result .= $self->_convert($arg);
-          if ($arg->{'type'} eq 'menu_entry_separator' and $node_seen) {
-            my $length = Texinfo::Convert::Unicode::string_width($result);
-            my $description_indent 
-              = $self->get_conf('TEXINFO_COLUMN_FOR_DESCRIPTION');
-            if ($length >= $description_indent) {
-              $arg->{'text'} .= ' ';
-            } else {
-              $arg->{'text'} .= ' ' x ($description_indent - $length);
-            }
-            last;
-          } elsif ($arg->{'type'} eq 'menu_entry_description') {
-            # This should never happen, but this is a safeguard for 
-            # incorrect trees.
-            last;  
-          }
-        }
-      }
-      #print STDERR "$result";
-    }
-  }
-}
-
-# FIXME document
-sub indent_menu_descriptions($;$)
-{
-  my $self = shift;
-  my $parser = shift;
-
-  if (!defined($self)) {
-    # setup a converter for menu
-    if (!defined($parser)) {
-      return undef;
-    }
-    $self = Texinfo::Convert::Plaintext->converter({'parser' => $parser});
-  } elsif (!defined($parser)) {
-    if (!defined($self->{'parser'})) {
-      return undef;
-    }
-    $parser = $self->{'parser'};
-  }
-
-  # setup the converter as if it was in a menu
-  my $cmdname = 'menu';
-  push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0,
-                                     'locations' => []};
-  push @{$self->{'context'}}, $cmdname;
-  push @{$self->{'format_context'}},
-           { 'cmdname' => $cmdname,
-             'paragraph_count' => 0,
-             'indent_level' =>
-                 $self->{'format_context'}->[-1]->{'indent_level'},
-           };
-  my $preformatted = $self->new_formatter('unfilled');
-  push @{$self->{'formatters'}}, $preformatted;
-
-  if ($parser->{'info'} and $parser->{'info'}->{'unassociated_menus'}) {
-    foreach my $menu (@{$parser->{'info'}->{'unassociated_menus'}}) {
-      $self->indent_one_menu_descriptions($menu);
-    }
-  }
-  if ($parser->{'nodes'} and @{$parser->{'nodes'}}) {
-    foreach my $node (@{$parser->{'nodes'}}) {
-      if ($node->{'menus'}) {
-        foreach my $menu (@{$node->{'menus'}}) {
-          $self->indent_menu_descriptions($menu);
-        }
-      }
-    }
-  }
-  pop @{$self->{'formatters'}};
-  pop @{$self->{'context'}};
-  pop @{$self->{'format_context'}};
-  pop @{$self->{'count_context'}};
-}
-
 1;
 
 __END__

Deleted: trunk/tp/t/indent_menu_descriptions.t
===================================================================
--- trunk/tp/t/indent_menu_descriptions.t       2016-10-06 20:15:54 UTC (rev 
7435)
+++ trunk/tp/t/indent_menu_descriptions.t       2016-10-08 10:27:00 UTC (rev 
7436)
@@ -1,56 +0,0 @@
-use strict;
-
-use Test::More;
-use File::Spec;
-BEGIN { plan tests => 2;
-        if (defined($ENV{'top_srcdir'})) {
-          unshift @INC, File::Spec->catdir($ENV{'top_srcdir'}, 'tp');
-          my $lib_dir = File::Spec->catdir($ENV{'top_srcdir'}, 'tp', 
'maintain');
-          unshift @INC, (File::Spec->catdir($lib_dir, 'lib', 'libintl-perl', 
'lib'),
-                         File::Spec->catdir($lib_dir, 'lib', 
'Unicode-EastAsianWidth', 'lib'),
-                         File::Spec->catdir($lib_dir, 'lib', 'Text-Unidecode', 
'lib'));
-      }};
-
-use lib 'maintain/lib/Unicode-EastAsianWidth/lib/';
-use lib 'maintain/lib/libintl-perl/lib/';
-use lib 'maintain/lib/Text-Unidecode/lib/';
-use Texinfo::Parser qw(parse_texi_text);
-use Texinfo::Convert::Plaintext;
-use Texinfo::Convert::Texinfo;
-
-ok(1);
-
-my $in = '
address@hidden
-Comment
-
-* a: (!unknown_m)b.   d
-* (!unknown_m)c  ::     d1
-* (!unknown_m)f ::
-* (!unknown_m)g ::    
-* label:   (!unknown_m)h  .
-* (!unknown_m)iiiiiiiiiiiiiiiiiiiiiiiiiiiiiii::    d
address@hidden menu
-';
-
-my $reference = '
address@hidden
-Comment
-
-* a: (!unknown_m)b.             d
-* (!unknown_m)c  ::             d1
-* (!unknown_m)f ::              
-* (!unknown_m)g ::              
-* label:   (!unknown_m)h  .     
-* (!unknown_m)iiiiiiiiiiiiiiiiiiiiiiiiiiiiiii:: d
address@hidden menu
-';
-
-my $parser = Texinfo::Parser::parser();
-my $tree = $parser->parse_texi_text($in);
-Texinfo::Convert::Plaintext::indent_menu_descriptions(undef, $parser);
-my $out = Texinfo::Convert::Texinfo::convert($tree);
-
-is ($out, $reference, 'indent menu descriptions test');
-
-#print STDERR "$out\n";

Modified: trunk/tp/texi2any.pl
===================================================================
--- trunk/tp/texi2any.pl        2016-10-06 20:15:54 UTC (rev 7435)
+++ trunk/tp/texi2any.pl        2016-10-08 10:27:00 UTC (rev 7436)
@@ -1313,10 +1313,6 @@
     Texinfo::Structuring::add_missing_menus($parser, $tree);
   }
 
-  if ($tree_transformations{'indent_menu_descriptions'}) {
-    Texinfo::Convert::Plaintext::indent_menu_descriptions(undef, $parser);
-  }
-
   if ($tree_transformations{'regenerate_master_menu'}) {
     Texinfo::Structuring::regenerate_master_menu($parser);
   }




reply via email to

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