Diff for /loncom/interface/lonprintout.pm between versions 1.489 and 1.490

version 1.489, 2006/10/23 10:40:09 version 1.490, 2006/10/24 10:37:58
Line 61  my $resources_printed; Line 61  my $resources_printed;
 #  #
 sub printf_style_subst {  sub printf_style_subst {
     my ($item, $format_string, $repl) = @_;      my ($item, $format_string, $repl) = @_;
       my $result = "";
     while ($format_string =~m/%\d*\Q$item\E/) {      while ($format_string =~ /(%)(\d*)\Q$item\E/g ) {
  my $fmt = $1;   my $fmt = $1;
  my $size = $2;   my $size = $2;
  my $subst = $repl;   my $subst = $repl;
  if ($size ne "") {   if ($size ne "") {
     $subst = substr($subst, 0, $size);      $subst = substr($subst, 0, $size);
       
       #  Here's a nice edge case.. supose the end of the
       #  substring is a \.  In that case may have  just
       #  chopped off a TeX escape... in that case, we append
       #   " " for the trailing character, and let the field 
       #  spill over a bit (sigh).
       #  We don't just chop off the last character in order to deal
       #  with one last pathology, and that would be if substr had
       #  trimmed us to e.g. \\\  
   
   
       if ($subst =~ /\\$/) {
    $subst .= " ";
       }
  }   }
  my $newpos =  pos($format_string) + length($subst) - length($fmt);   my $item_pos = pos($format_string);
  $format_string =~ s/\Q$fmt\E/$subst/;   $result .= substr($format_string, 0, $item_pos - length($size) -2) . $subst;
  pos($format_string)=$newpos;          $format_string = substr($format_string, pos($format_string));
     }      }
     return $format_string;  
       # Put the residual format string into the result:
   
       $result .= $format_string;
   
       return $result;
 }  }
   
   
Line 133  sub format_page_header { Line 152  sub format_page_header {
  # to \% else LaTeX will think they are comments and terminate   # to \% else LaTeX will think they are comments and terminate
  # the line.. which is bad!!!   # the line.. which is bad!!!
   
  $format =~ s/%/\\%/g;  
     }      }
           
   
Line 157  sub num_to_letters { Line 176  sub num_to_letters {
 sub letters_to_num {  sub letters_to_num {
     my ($letters) = @_;      my ($letters) = @_;
     my @letters = split('', uc($letters));      my @letters = split('', uc($letters));
     my %substitution;     my %substitution;
     my $digit = 0;      my $digit = 0;
     foreach my $letter ('A'..'J') {      foreach my $letter ('A'..'J') {
  $substitution{$letter} = $digit;   $substitution{$letter} = $digit;

Removed from v.1.489  
changed lines
  Added in v.1.490


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>