texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp/Texinfo/Convert Converter.pm DocBook...


From: Patrice Dumas
Subject: texinfo/tp/Texinfo/Convert Converter.pm DocBook...
Date: Sun, 13 May 2012 22:48:09 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        12/05/13 22:48:09

Modified files:
        tp/Texinfo/Convert: Converter.pm DocBook.pm Unicode.pm 

Log message:
        Handle misc skipspace commands in DocBook.
        Adapt character counting to perl v5.14.2 as a new line is not IsPrint.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Converter.pm?cvsroot=texinfo&r1=1.81&r2=1.82
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/DocBook.pm?cvsroot=texinfo&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Unicode.pm?cvsroot=texinfo&r1=1.29&r2=1.30

Patches:
Index: Converter.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Converter.pm,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -b -r1.81 -r1.82
--- Converter.pm        21 Apr 2012 17:44:48 -0000      1.81
+++ Converter.pm        13 May 2012 22:48:07 -0000      1.82
@@ -503,6 +503,38 @@
   $self->{'output_file'} = $outfile;
 }
 
+sub _bug_message($$;$)
+{
+  my $self = shift;
+  my $message = shift;
+  my $current = shift;
+
+  my $line_message = '';
+  my $current_element_message = '';
+  if ($current) {
+    if ($current->{'line_nr'}) {
+      my $line_number = $current->{'line_nr'};
+      my $file = $line_number->{'file_name'};
+      $line_message
+        = "in: $line_number->{'file_name'}:$line_number->{'line_nr'}";
+      if ($line_number->{'macro'} ne '') {
+        $line_message .= " (possibly involving $line_number->{'macro'})";
+      }
+      $line_message .= "\n";
+    }
+    if ($current) {
+      $current_element_message = "current: ". 
+        Texinfo::Parser::_print_current($current);
+    }
+  }
+  my $additional_information = '';
+  if ($line_message.$current_element_message ne '') {
+    $additional_information = "Additional informations:\n".
+       $line_message.$current_element_message;
+  }
+  warn "You found a bug: $message\n\n".$additional_information;
+}
+
 sub output($$)
 {
   my $self = shift;

Index: DocBook.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/DocBook.pm,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- DocBook.pm  14 Feb 2012 22:27:42 -0000      1.44
+++ DocBook.pm  13 May 2012 22:48:08 -0000      1.45
@@ -663,7 +663,7 @@
         } else {
           return '';
         }
-      } elsif ($type eq 'special') {
+      } elsif ($type eq 'special' or $type eq 'skipspace') {
         return '';
       } elsif ($type eq 'lineraw') {
         if ($root->{'cmdname'} eq 'c' or $root->{'cmdname'} eq 'comment') {
@@ -672,7 +672,8 @@
           return "";
         }
       } else {
-        print STDERR "BUG: unknown misc_command style $type" if ($type !~ 
/^\d$/);
+        $self->_bug_message("unknown misc_command style $type", $root)
+          if ($type !~ /^\d$/);
         if ($root->{'cmdname'} eq 'printindex') {
           if (defined($root->{'extra'})
               and defined($root->{'extra'}->{'misc_args'})) {

Index: Unicode.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Unicode.pm,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- Unicode.pm  24 Jan 2012 22:16:57 -0000      1.29
+++ Unicode.pm  13 May 2012 22:48:08 -0000      1.30
@@ -1460,9 +1460,15 @@
     if ($character =~ /\p{Unicode::EastAsianWidth::InFullwidth}/) {
       $width += 2;
     } elsif ($character =~ /\pM/) {
-      # a mark, consider it to be of lenght 0.
-    } elsif ($character =~ /\p{IsPrint}/) {
+      # a mark set at length 0
+    } elsif ($character =~ /\p{IsPrint}/ or $character =~ /\p{IsSpace}/) {
+      # newlines are not {IsPrint} in v5.14.2
       $width += 1;
+    } elsif ($character =~ /\p{IsControl}/) {
+      # Control chars may be added, for instance, as part of @image formatting
+    #} elsif ($character eq '') { # could that happen?
+    } else {
+      #print STDERR "unknown char`$character'\n";
     }
   }
   return $width;



reply via email to

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