texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp TODO Texinfo/Parser.pm Texinfo/Struc...


From: Patrice Dumas
Subject: texinfo/tp TODO Texinfo/Parser.pm Texinfo/Struc...
Date: Sun, 29 May 2011 23:50:57 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/05/29 23:50:57

Modified files:
        tp             : TODO 
        tp/Texinfo     : Parser.pm Structuring.pm 
        tp/Texinfo/Convert: HTML.pm 

Log message:
        Use index entry content in printindex.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/TODO?cvsroot=texinfo&r1=1.126&r2=1.127
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.252&r2=1.253
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Structuring.pm?cvsroot=texinfo&r1=1.58&r2=1.59
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.67&r2=1.68

Patches:
Index: TODO
===================================================================
RCS file: /sources/texinfo/texinfo/tp/TODO,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -b -r1.126 -r1.127
--- TODO        28 May 2011 23:27:39 -0000      1.126
+++ TODO        29 May 2011 23:50:57 -0000      1.127
@@ -1,10 +1,3 @@
-
-Test to add (warning when --html):
-
address@hidden strong}
address@hidden blah.
-
-
 LINKS_BUTTONS as config, check and document.
 
 API HTML:
@@ -99,18 +92,10 @@
 @ protecting end of lines in @def* is not kept in any way in the tree.
 Maybe it could be possible to have it as a 'type'?
 
-for i18n, one want to do something like
-{style} {number}: {caption}
-  -> new tree. 
-
-and 
-section {section} in @cite{{manual}} 
-  -> new tree
-
-and also maybe
-{acronym_like} ({explanation})
-  -> replace acronym_like with the already formatted text and 
-     explanation with convert(explanation).
+in HTML, the argument of a quotation is ignored if the quotation is empty,
+like in
+ @quotation thing
+ @end quotation
 
 def/end_of_lines_protected_in_footnote.pl the footnote is
    (1)  -- category: deffn_name arguments arg2 more args with end of line

Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.252
retrieving revision 1.253
diff -u -b -r1.252 -r1.253
--- Texinfo/Parser.pm   29 May 2011 22:32:08 -0000      1.252
+++ Texinfo/Parser.pm   29 May 2011 23:50:57 -0000      1.253
@@ -923,7 +923,11 @@
   $args = "args(".scalar(@{$current->{'args'}}).')' if $current->{'args'};
   $contents = "contents(".scalar(@{$current->{'contents'}}).')'
     if $current->{'contents'};
-  return "$cmd$type : $args $text $contents\n$parent_string";
+  if ("$cmd$type" ne '') {
+    return "$cmd$type : $text $args $contents\n$parent_string";
+  } else {
+    return "$text $args $contents\n$parent_string";
+  }
 }
 
 sub _print_current_keys($)

Index: Texinfo/Structuring.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Structuring.pm,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -b -r1.58 -r1.59
--- Texinfo/Structuring.pm      30 Apr 2011 23:55:49 -0000      1.58
+++ Texinfo/Structuring.pm      29 May 2011 23:50:57 -0000      1.59
@@ -108,29 +108,6 @@
   return $current;
 }
 
-# For debugging
-sub _print_current($)
-{
-  my $current = shift;
-  my $type = '';
-  my $cmd = '';
-  my $parent_string = '';
-  my $text = '';
-  $type = "($current->{'type'})" if (defined($current->{'type'}));
-  $cmd = "address@hidden>{'cmdname'}" if (defined($current->{'cmdname'}));
-  $text = "[text: $current->{'text'}]" if (defined($current->{'text'}));
-  my $args = '';
-  my $contents = '';
-  $args = "args(".scalar(@{$current->{'args'}}).')' if $current->{'args'};
-  $contents = "contents(".scalar(@{$current->{'contents'}}).')'
-    if $current->{'contents'};
-  if ("$cmd$type" ne '') {
-    return "$cmd$type : $text $args $contents\n";
-  } else {
-    return "$text $args $contents\n";
-  }
-}
-
 # Not used for now
 # the tree is modified: 'next' pointers are added.
 sub _collect_structure($)
@@ -150,7 +127,7 @@
         $current->{'args'}->[$i]->{'next'} = $current->{'args'}->[$i+1];
       }
     }
-    print STDERR ""._print_current($current);
+    print STDERR "".Texinfo::Parser::_print_current($current);
     $current = _next_content($current);
   }
 }
@@ -992,7 +969,7 @@
                 : (($a =~ /^[[:alpha:]]/ && 1) || -1);
 }
 
-sub _sort_subroutine($$)
+sub _sort_index_entries($$)
 {
   my $key1 = shift;
   my $key2 = shift;
@@ -1005,7 +982,7 @@
   return $res;
 }
 
-sub _sort_entries_in_letter($$)
+sub _sort_index_entries_in_letter($$)
 {
   my $key1 = shift;
   my $key2 = shift;
@@ -1043,7 +1020,7 @@
   _do_index_keys($self, $index_entries);
   foreach my $index_name (keys(%$index_entries)) {
     @{$sorted_index_entries->{$index_name}} = 
-        sort _sort_subroutine @{$index_entries->{$index_name}};
+        sort _sort_index_entries @{$index_entries->{$index_name}};
   }
   return $sorted_index_entries;
 }
@@ -1062,7 +1039,7 @@
     }
     foreach my $letter (sort _sort_string (keys %$index_letter_hash)) {
       my @sorted_letter_entries 
-         = sort _sort_entries_in_letter @{$index_letter_hash->{$letter}};
+         = sort _sort_index_entries_in_letter @{$index_letter_hash->{$letter}};
       push @{$indices_sorted_by_letters->{$index_name}},
         { 'letter' => $letter, 'entries' => address@hidden }; 
     }

Index: Texinfo/Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -b -r1.67 -r1.68
--- Texinfo/Convert/HTML.pm     29 May 2011 22:32:08 -0000      1.67
+++ Texinfo/Convert/HTML.pm     29 May 2011 23:50:57 -0000      1.68
@@ -399,10 +399,15 @@
                and $command->{'extra'}->{'special_element'}) {
         my $special_element = $command->{'extra'}->{'special_element'};
         $tree = $self->get_conf('SPECIAL_ELEMENTS_NAME')->{$special_element};
-      } elsif ($command->{'cmdname'} eq 'node') {
+      } elsif ($command->{'cmdname'} and ($command->{'cmdname'} eq 'node' 
+                                          or $command->{'cmdname'} eq 
'anchor')) {
         $tree = {'type' => '_code',
                  'contents' => $command->{'extra'}->{'node_content'}};
       } else {
+        if (!$command->{'extra'}->{'misc_content'}) {
+          cluck "No misc_content: "
+            .Texinfo::Parser::_print_current($command);
+        }
         $tree = {'contents' => address@hidden>{'extra'}->{'misc_content'}}]};
         if ($command->{'number'}) {
           unshift @{$tree->{'contents'}}, {'text' => "$command->{'number'} "};
@@ -1992,7 +1997,7 @@
       $prepend = '';
     } else {
       $prepend = $self->convert_tree(
-         {'contents' => $itemize->{'extra'}->{'block_command_line_contents'}});
+         {'contents' => 
$itemize->{'extra'}->{'block_command_line_contents'}->[0]});
     }
     if ($contents =~ /\S/) {
       return '<li>' . $prepend .' '. $contents . '</li>';
@@ -2253,15 +2258,13 @@
     foreach my $index_entry_ref (@{$letter_entry->{'entries'}}) {
       my $in_code 
        = 
$self->{'index_names'}->{$index_name}->{$index_entry_ref->{'index_name'}};
-      my $entry_tree = $self->command_text ($index_entry_ref->{'command'}, 
-                                            'tree');
       my $entry;
       if ($in_code) {
         # FIXME clean state
         $entry = $self->convert_tree({'type' => '_code',
-                                      'contents' => [$entry_tree]});
+                                      'contents' => 
$index_entry_ref->{'content'}});
       } else {
-        $entry = $self->convert_tree($entry_tree);
+        $entry = $self->convert_tree({'contents' => 
$index_entry_ref->{'content'}});
       }
       next if ($entry !~ /\S/);
       $entry = '<code>' .$entry .'</code>' if ($in_code);
@@ -3886,10 +3889,10 @@
         my $region = '';
         $region = "$index_entry->{'region'}-" 
           if (defined($index_entry->{'region'}) and $index_entry->{'region'} 
ne '');
-        my $normalized_index = _normalized_to_id(
+        my $normalized_index =
           Texinfo::Convert::NodeNameNormalization::transliterate_texinfo(
             {'contents' => $index_entry->{'content'}},
-                  $no_unidecode));
+                  $no_unidecode);
         my $target_base = "index-" . $region .$normalized_index;
         my $nr=1;
         my $target = $target_base;
@@ -5089,7 +5092,7 @@
       # TODO different types of contents
       if (ref($root->{'contents'}) ne 'ARRAY') {
         cluck "for $root contents not an array: $root->{'contents'}";
-        print STDERR Texinfo::Structuring::_print_current($root);
+        print STDERR Texinfo::Parser::_print_current($root);
       }
 
       # FIXME as texi2html, ignore space only contents at the beginning.



reply via email to

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