texi2html-cvs
[Top][All Lists]
Advanced

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

[Texi2html-cvs] texi2html/examples info.init


From: Patrice Dumas
Subject: [Texi2html-cvs] texi2html/examples info.init
Date: Mon, 29 Dec 2008 13:28:47 +0000

CVSROOT:        /cvsroot/texi2html
Module name:    texi2html
Changes by:     Patrice Dumas <pertusus>        08/12/29 13:28:47

Modified files:
        examples       : info.init 

Log message:
        Store pending text before anchor

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texi2html/examples/info.init?cvsroot=texi2html&r1=1.6&r2=1.7

Patches:
Index: info.init
===================================================================
RCS file: /cvsroot/texi2html/texi2html/examples/info.init,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- info.init   29 Dec 2008 12:28:11 -0000      1.6
+++ info.init   29 Dec 2008 13:28:47 -0000      1.7
@@ -174,6 +174,7 @@
     return '' if ($copying_text eq '');
     return $copying_text;
 }
+
 my @info_default_all_stacks;
 my $info_default_top_stack;
 my $info_default_current_command;
@@ -295,6 +296,23 @@
     }
 }
 
+sub info_default_store_pending($$$)
+{
+   my $line_char_counter = shift;
+   my $pending_spaces = shift;
+   my $pending_word = shift;
+   
+   my $result = $pending_spaces;
+   $pending_spaces = '';
+   if (defined($pending_word))
+   {
+      $result .= $pending_word;
+      $pending_word = undef;
+   }
+   $line_char_counter += length($result) if (defined($line_char_counter));
+   return ($line_char_counter, $pending_spaces, $pending_word, $result);
+}
+
 my $info_default_end_sentence_character = quotemeta('.');
 
 sub info_default_process_content($$)
@@ -327,6 +345,8 @@
           {
               $text_added = $content->{'end'};
           }
+          # if ending a paragraph, go straight to the text addition 
+          # without processing of the end of lines
           if (defined($content->{'command'}) and $content->{'command'} eq 
'paragraph')
           {
               $line_char_counter = undef;
@@ -340,6 +360,13 @@
           { 
               if ($content->{'command'} eq 'anchor')
               {
+                  my $pending;
+                  ($line_char_counter, $pending_spaces, $pending_word, 
$pending) = info_default_store_pending($line_char_counter, $pending_spaces, 
$pending_word);
+                  if (defined($line_char_counter) or $pending !~ /^\s*$/)
+                  {
+                      $length += length($pending);
+                      $result .= $pending;
+                  }
                   $content->{'anchor_reference'}->{'info_offset'} = $length + 
$base_offset;
                   push @info_default_pending_tags, 
$content->{'anchor_reference'};
               }




reply via email to

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