texlive[44624] Master/install-tl: Line breaking for text-mode __

commits+siepo at tug.org commits+siepo at tug.org
Sat Jun 17 22:15:35 CEST 2017


Revision: 44624
          http://tug.org/svn/texlive?view=revision&revision=44624
Author:   siepo
Date:     2017-06-17 22:15:35 +0200 (Sat, 17 Jun 2017)
Log Message:
-----------
Line breaking for text-mode __ function

Modified Paths:
--------------
    trunk/Master/install-tl

Modified: trunk/Master/install-tl
===================================================================
--- trunk/Master/install-tl	2017-06-17 00:21:17 UTC (rev 44623)
+++ trunk/Master/install-tl	2017-06-17 20:15:35 UTC (rev 44624)
@@ -602,7 +602,7 @@
   }
   do_cleanup(); # sets $::LOGFILENAME if not already defined
   if ($LOGFILENAME) {
-    print STDOUT "Logfile: $::LOGFILENAME\n";
+    print STDOUT "\nLogfile: $::LOGFILENAME\n";
   } else {
     # do_cleanup sets $::LOGFILENAME to ""
     #if no logfile could be written
@@ -2385,6 +2385,7 @@
     "See %s/index.html for links to documentation.\nThe TeX Live web site (http://tug.org/texlive/) contains any updates and corrections. TeX Live is a joint project of the TeX user groups around the world; please consider supporting it by joining the group best for you. The list of groups is available on the web at http://tug.org/usergroups.html.",
     $::vars{'TEXDIR'});
   if (!win32()) {
+    push @::welcome_arr, "\n";
     push @::welcome_arr, __(
       "Add %s/texmf-dist/doc/man to MANPATH.\nAdd %s/texmf-dist/doc/info to INFOPATH.\nMost importantly, add %s/bin/%s\nto your PATH for current and future sessions.",
       $::vars{'TEXDIR'}, $::vars{'TEXDIR'}, $::vars{'TEXDIR'},
@@ -2431,9 +2432,46 @@
 # assign \&___ to *__ if __ is not otherwise defined
 sub ___ {
   my $s = shift;
-  return sprintf($s, @_);
+  return wrapped (sprintf($s, @_));
 }
 
+sub wrapped {
+  my $t = shift;
+  my $toolong = '.{79}';
+  if ($t !~ $toolong) {
+    return $t;
+  } else {
+    my @lines = split /\n/, $t;
+    foreach my $l (@lines) {
+      if ($l !~ $toolong) {
+        next; # leave $l alone
+      }
+      my @words = split /\s+/, $l;
+      if (! @words) {
+        $l = "";
+        next;
+      } else {
+        my $indent = $l;
+        $indent =~ s/^(\s*).*$/$1/; # extract leading spaces
+        my @broken = ();
+        my $inx = 0;
+        while (@words) {
+          if (not ((defined $broken[$inx]) && ($broken[$inx] =~ /\S/))) {
+            $broken[$inx] = $indent . (shift @words);
+          } elsif (($broken[$inx] . " " . $words[0]) =~ $toolong) {
+            $inx++; # NO word consumed, still words remaining
+          } else {
+            $broken[$inx] = $broken[$inx] . " " . (shift @words);
+          } # $l =~ $toolong
+        } # while @words
+        $l = join "\n", @broken;
+      } # @words
+    } # foreach my $l
+    return join "\n", @lines;
+  } # $t =~ $toolong
+} # wrapped
+
+
   __END__
 

 =head1 NAME



More information about the tex-live-commits mailing list