=================================================================== RCS file: /cvs/cvsweb/cvsweb.cgi,v retrieving revision 3.16 retrieving revision 3.20 diff -u -p -r3.16 -r3.20 --- cvsweb/cvsweb.cgi 2000/09/03 17:33:22 3.16 +++ cvsweb/cvsweb.cgi 2000/09/10 11:54:21 3.20 @@ -42,7 +42,7 @@ # SUCH DAMAGE. # # $zId: cvsweb.cgi,v 1.94 2000/08/24 06:41:22 hnordstrom Exp $ -# $Id: cvsweb.cgi,v 3.16 2000/09/03 17:33:22 knu Exp $ +# $Id: cvsweb.cgi,v 3.20 2000/09/10 11:54:21 knu Exp $ # ### @@ -53,8 +53,8 @@ use vars qw ( %CVSROOT %CVSROOTdescr %MIRRORS %DEFAULTVALUE %ICONS %MTYPES %alltags @tabcolors %fileinfo %tags @branchnames %nameprinted %symrev %revsym @allrevisions %date %author @revdisplayorder - @revisions %state %difflines %log %branchpoint @revorder $prcgi - @prcategories $prcategories + @revisions %state %difflines %log %branchpoint @revorder + $prcgi @prcategories $prcategories $mancgi $checkoutMagic $doCheckout $scriptname $scriptwhere $where $pathinfo $Browser $nofilelinks $maycompress @stickyvars %funcline_regexp $is_mod_perl @@ -82,7 +82,7 @@ use vars qw ( sub printDiffSelect($); sub findLastModifiedSubdirs(@); sub htmlify($;$); -sub spacedHtmlText($); +sub spacedHtmlText($;$); sub link($$); sub revcmp($$); sub fatal($$); @@ -347,6 +347,7 @@ foreach my $k (keys %ICONS) { do "$config-$cvstree" if (-f "$config-$cvstree"); $prcategories = '(?:' . join('|', @prcategories) . ')'; +$prcgi .= '%s' if defined($prcgi) && $prcgi !~ /%s/; $fullname = $cvsroot . '/' . $where; $mimetype = &getMimeTypeFromSuffix ($fullname); @@ -886,7 +887,7 @@ sub findLastModifiedSubdirs(@) { } sub htmlify($;$) { - my($string, $pr) = @_; + my($string, $extra) = @_; # Special Characters; RFC 1866 $string =~ s/&/&/g; @@ -895,48 +896,52 @@ sub htmlify($;$) { $string =~ s/>/>/g; # get URL's as link .. - $string =~ s`(http|ftp|https)(://[-a-zA-Z0-9%.~:_/]+)([?&]([-a-zA-Z0-9%.~:_]+)=([-a-zA-Z0-9%.~:_])+)*`$1$2$3`g; + $string =~ s`(http|ftp|https)(://[-a-zA-Z0-9%.~:_/]+)([?&]([-a-zA-Z0-9%.~:_]+)=([-a-zA-Z0-9%.~:_])+)*`$1$2$3`g; # ` # get e-mails as link - $string =~ s`([-a-zA-Z0-9_.]+@([-a-zA-Z0-9]+\.)+[A-Za-z]{2,4})`$1`g; + $string =~ s`([-a-zA-Z0-9_.]+@([-a-zA-Z0-9]+\.)+[A-Za-z]{2,4})`$1`g; # ` - # get #PR as link .. - if ($pr && defined($prcgi)) { - 1 while $string =~ s`\b(pr[:#]?\s*(?:#?\d+[,\s]\s*)*#?)(\d+)\b`$1$2`i; - $string =~ s`\b${prcategories}/(\d+)\b`$&`igo; + if ($extra) { + # get PR #'s as link .. + if (defined($prcgi)) { + 1 while $string =~ s`\b(pr[:#]?\s*(?:#?\d+[,\s]\s*)*#?)(\d+)\b`$1 . &link($2, sprintf($prcgi, $2))`ie; # ` + $string =~ s`\b${prcategories}/(\d+)\b`&link($&, sprintf($prcgi, $1))`igeo; # ` + } + + # get manpage specs as link .. + if (defined($mancgi)) { + $string =~ s`\b([a-zA-Z]\w+)\(([0-9n])\)\B`&link($&, sprintf($mancgi, $2, $1))`ge; # ` + } } return $string; } -sub spacedHtmlText($) { +sub spacedHtmlText($;$) { local $_ = $_[0]; + my $ts = $_[1] || $tabstop; - # Cut trailing spaces - s/\s+\n$//; + # Cut trailing spaces and tabs + s/[ \t]+$//; - # Expand tabs - s/\t+/' ' x (length($&) * $tabstop - length($`) % $tabstop)/e - if (defined($tabstop)); + if (defined($tabstop)) { + # Expand tabs + 1 while s/\t+/' ' x (length($&) * $ts - length($`) % $ts)/e + } # replace and (\001 is to protect us from htmlify) # gzip can make excellent use of this repeating pattern :-) - s/\001/\001%/g; #protect our & substitute if ($hr_breakable) { # make every other space 'breakable' - s/ / \001nbsp; \001nbsp; \001nbsp; \001nbsp;/g; # s/ / \001nbsp;/g; # 2 * # leave single space as it is - } - else { - s/ /\001nbsp;\001nbsp;\001nbsp;\001nbsp;\001nbsp;\001nbsp;\001nbsp;\001nbsp;/g; + } else { s/ /\001nbsp;/g; } $_ = htmlify($_); # unescape - s/\001([^%])/&$1/g; - s/\001%/\001/g; + y/\001/&/; return $_; } @@ -1174,6 +1179,7 @@ sub doAnnotate($$) { } else { $revprint = $lrev; $oldLusr = ""; + $revprint =~ s`^(\S+)`$1`; # ` } if ($lusr eq $oldLusr) { $usrprint = " "; @@ -2382,7 +2388,7 @@ sub navigateHeader($$$$$) { $swhere = urlencode($filename) if ($swhere eq ""); print "<\!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"; print "\n\n"; - print ''; + print ''; print "\n$path$filename - $title - $rev\n"; print "\n"; print ""; @@ -2734,7 +2740,7 @@ sub http_header(;$) { sub html_header($) { my ($title) = @_; - my $version = '$zRevision: 1.94 $ $Revision: 3.16 $'; #' + my $version = '$zRevision: 1.94 $ $Revision: 3.20 $'; #' http_header(); print <