texinfo-commits
[Top][All Lists]
Advanced

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

[6753] no break in double width text in xrefs


From: Gavin D. Smith
Subject: [6753] no break in double width text in xrefs
Date: Tue, 03 Nov 2015 17:40:21 +0000

Revision: 6753
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6753
Author:   gavin
Date:     2015-11-03 17:40:20 +0000 (Tue, 03 Nov 2015)
Log Message:
-----------
no break in double width text in xrefs

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-11-03 16:00:27 UTC (rev 6752)
+++ trunk/ChangeLog     2015-11-03 17:40:20 UTC (rev 6753)
@@ -1,5 +1,19 @@
 2015-11-03  Gavin Smith  <address@hidden>
 
+       Prevent line breaks in Chinese text in cross-refereces, reported 
+       by Brendan O'Dea.       
+       
+       * tp/Texinfo/Convert/ParagraphNonXS.pm
+       (set_space_protection): New parameter, 'double_width_no_break'.
+       (add_text) <double-width character>: If 'double_width_no_break' 
+       flag is on, accumulate double-width characters just as if 
+       'protect_spaces' were on.
+       * tp/Texinfo/Convert/Plaintext.pm (_convert) <Cross-reference 
+       commands>.  Call set_space_protection to set 
+       'double_width_no_break' for the output for the cross-reference.
+
+2015-11-03  Gavin Smith  <address@hidden>
+
        * tp/t/plaintext.t (east_asian_in_w): New test.
        * tp/t/input_files/east_asian_in_w.texi: Input file.
        * t/results/plaintext_tests/

Modified: trunk/tp/Texinfo/Convert/ParagraphNonXS.pm
===================================================================
--- trunk/tp/Texinfo/Convert/ParagraphNonXS.pm  2015-11-03 16:00:27 UTC (rev 
6752)
+++ trunk/tp/Texinfo/Convert/ParagraphNonXS.pm  2015-11-03 17:40:20 UTC (rev 
6753)
@@ -272,13 +272,14 @@
   $paragraph->{'last_char'} = 'a'; # lower-case
 }
 
-sub set_space_protection($$;$$$)
+sub set_space_protection($$;$$$$)
 {
   my $paragraph = shift;
   my $space_protection = shift;
   my $ignore_columns = shift;
   my $keep_end_lines = shift;
   my $frenchspacing = shift;
+  my $double_width_no_break = shift;
   $paragraph->{'protect_spaces'} = $space_protection 
     if defined($space_protection);
   $paragraph->{'ignore_columns'} = $ignore_columns
@@ -295,6 +296,8 @@
   }
   $paragraph->{'frenchspacing'} = $frenchspacing
     if defined($frenchspacing);
+  $paragraph->{'double_width_no_break'} = $double_width_no_break
+    if defined($double_width_no_break);
   # begin a word, to have something even if empty
   if ($space_protection) {
     _add_next($paragraph, '');
@@ -441,11 +444,12 @@
                                > $paragraph->{'max'}) {
         $result .= _cut_line($paragraph);
       }
-      if (!$paragraph->{'protect_spaces'}) {
+      if (!$paragraph->{'protect_spaces'}
+          and !$paragraph->{'double_width_no_break'}) {
         $result .= _add_pending_word($paragraph);
+        $paragraph->{'space'} = '';
       }
       delete $paragraph->{'end_sentence'};
-      $paragraph->{'space'} = '';
     }
   }
   return $result;

Modified: trunk/tp/Texinfo/Convert/Plaintext.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Plaintext.pm       2015-11-03 16:00:27 UTC (rev 
6752)
+++ trunk/tp/Texinfo/Convert/Plaintext.pm       2015-11-03 17:40:20 UTC (rev 
6753)
@@ -2120,6 +2120,11 @@
             $formatter->{'container'}->set_space_protection(1,undef))
           if ($formatter->{'w'} == 1);
         }
+        # Disallow breaks in runs of Chinese text in node names, because a 
+        # break would be normalized to a single space by the Info reader, and 
+        # the node wouldn't be found.
+        $formatter->{'container'}
+  ->set_space_protection(undef,undef,undef,undef,1); # double_width_no_break
 
         if ($command eq 'xref') {
           $result = $self->_convert({'contents' => [{'text' => '*Note '}]});
@@ -2284,6 +2289,8 @@
               $formatter->{'container'}->set_space_protection(0,undef))
             if ($formatter->{'w'} == 0);
         }
+        $formatter->{'container'}
+  ->set_space_protection(undef,undef,undef,undef,0); # double_width_no_break
         return $result;
       }
       return '';




reply via email to

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