📄 cvs2html
字号:
# This just skips over this file. } if(defined($opt_V) && $opt_V>2) { print STDOUT " Getting metadata\n"; } $leftfill = 0; $line = getnextline; while ($newfile==0) { if ($line =~ /revision (\S*)/) { $revnumber=$1; } else { $revnumber = "[Error_in_revnumber]"; } $line = getnextline; if ($line =~ /date: (...................)/) { $revdate = $1; } else { $revdate = "[Error_in_revdate]"; } if ($line =~ /author: ([a-zA-Z0-9_.]*);/) { $author = $1; } else { $author = "[Error_in_author]"; } if ($line =~ /lines: ([+\-0-9 ]*)$/) { $changelines = $1; } else { $changelines = "None"; } $line = getnextline; if ($line =~ /branches: (.*)/) { $line = getnextline; } ($rd1,$rd2,$rd3,$rdrest) = $revdate =~ /^(\d+)\/(\d+)\/(\d+) (.*)$/; $revdateformat2 = $rd1.$rd2.$rd3; ($rt1,$rt2,$rt3) = $rdrest =~/(\d+)\:(\d+)\:(\d+)/; $revdateformat3 = 3600*$rt1+60*$rt2+$rt3+86400*$revdateformat2; $printfilename = $printfilename + 1; $fname=""; if ($opt_f) { $fname = '~'.$filename; } if ((($fnumber == 1) || ($opt_f)) && ($printfilename==1)) { if (($opt_f) && ($fnumber==1)){ $rfoutname = $outdirname.'/'.$outfilename.$convdir."__rf.html"; open(OUTFILE,">$rfoutname") or die "Error: Could not open $rfoutname\n."; @listhtmlnames = (@listhtmlnames,$rfoutname); if (length($currentdir)==1) { print OUTFILE html_header("--- $rootdir ---"); } else { print OUTFILE html_header("--- $rootdir/$currentdir ---"); } print OUTFILE "<h3>Select entries from the left panel to get to the cvs log information for the files</h3>\n"; print OUTFILE html_footer(""); print OUTFILE "</body>\n</html>\n"; close(OUTFILE); } # Lets open the main file and process if ($frames == 1) { $rfoutname = $outdirname.'/'.$outfilename.$convdir.$fname."__rf.html"; open(OUTFILE,">$rfoutname") or die "Error: Could not open $rfoutname\n."; @listhtmlnames = (@listhtmlnames,$rfoutname); } else { $mainoutname = $outdirname.'/'.$outfilename.$convdir.$fname.".html"; open(OUTFILE,">$mainoutname") or die "Error: Could not open $mainoutname\n."; @listhtmlnames = (@listhtmlnames,$mainoutname); } $fnumber=2; if (length($currentdir)==1) { print OUTFILE html_header("--- $rootdir ---"); } else { print OUTFILE html_header("--- $rootdir/$currentdir ---"); } if ($opt_v) { print OUTFILE cvsrootinfo(); } } $needthisrevision = 0; if (($revdateformat2 >= $cutdate) and ($revnumber ne $startrevision)) { $needthisrevision = 1; } if ( $needthisrevision or $needthisdiffonly ) { if (($onlist == 0) && ($printfilename == 1)) { print OUTFILE "<a name=\"$filename\">\n</a>\n"; print OUTFILE "<table border=0 cellspacing=1 cellpadding=3 bgcolor=\"$cellcolor\" width=\"100%\">\n"; print OUTFILE "<tr>\n"; print OUTFILE "<td colspan=4 bgcolor=\"$filenamecellcolor\"><b><font size=\"+1\">\n"; $cdir = ""; if (length($currentdir)>1) { $cdir = '/'.$currentdir; } $Ls = ""; $Le = ""; if ($opt_L) { ($flname,$ext) = $filename =~ /^([a-zA-Z0-9+-_]*)\.([a-zA-Z0-9]*)$/; if (length($ext)==0) { $flname = $filename; } $Ls = "<a href=\"$opt_L$cdir/$flname".".html\" target=\"_top\">"; $Le = "</a>\n"; } print OUTFILE $Ls."Filename".$Le.": "; $Ls = ""; $Le = ""; if (($opt_l) && ($opt_R)) { $Ls = "<a href=\"$opt_l$cdir/$filename\?cvsroot\=$opt_R\">"; $Le = "</a>\n"; } elsif (($opt_l) && (! opt_R)) { $Ls = "<a href=\"$opt_l$cdir/$filename\">"; $Le = "</a>\n"; } print OUTFILE $Ls.$filename.$Le; print OUTFILE "</font></B><br></td></tr>\n"; } $onlist = 1; if (($opt_o) && ($leftfill == 0)) { if ($opt_f) { $chronolinker = $outfilename.$convdir.'~'.$filename.'__rf.html'; } else { $chronolinker = $outfilename.$convdir.'__rf.html#'.$filename; } # justcollect, we'll output them sorted on filename $outfile2lines{$filename}="<tr><td><a href=\"$chronolinker\" target=\"rf\"><font size=\"-1\">$filename</font></a></td></tr>\n"; $leftfill=2; } if (($opt_a) && ($oldrevnumber!=0) && ($nodiff!=0)) { print OUTFILE "<tr><td colspan=4 bgcolor=\"$differencebackground\"><i>Show difference between <a href=\"$diffdirname/diff$convdir\_$filename\_$oldrevnumber\_$revnumber.html\">Revision $revnumber and $oldrevnumber </a></i>\n"; generate_diff_file; $nodiff--; } $oldrevnumber=$revnumber; if ( $needthisrevision==0 ) { $needthisdiffonly = 0; } if ( $needthisrevision!=0 ) { if (($opt_a) && ($nodiff!=0)) { $needthisdiffonly = 1; } print OUTFILE "<tr><td><b>Revision $revnumber</b><td>$author\n"; print OUTFILE "<td>$revdate"; if (length($changelines)<2) { print OUTFILE "<td>None\n"; } else { print OUTFILE "<td>$changelines\n"; } print OUTFILE "<tr><td colspan=4>\n"; if ($dochrono) { $chronocounter++; $nams = $currentdirformat2.$filename; @chronoindex = (@chronoindex,$chronocounter); @chrononame = (@chrononame,$nams); @chronoauthor = (@chronoauthor,$author); @chronoversion = (@chronoversion,$revnumber); @chronoshowtime = (@chronoshowtime,$revdate); @chronotimesince0 = (@chronotimesince0,$revdateformat3); @chronolinknames = (@chronolinknames,$chronolinker); } } } # While more log read and process $morelog=1; while ($morelog==1) { if ($line =~ /^----------*$/) { $morelog=0; } else { if ($line =~ /^========*$/) { $newfile=1; $morelog=0; } else { $_=$line; s/&/&/g; s/\"/"/g; s/</</g; s/>/>/g; $line=$_; if ($line =~ /^(.*)$/) { if (($revdateformat2 >= $cutdate) and ($revnumber ne $startrevision)) { if ($opt_e) { print OUTFILE "<code>$1</code><br>\n"; } else { print OUTFILE "$1<br>\n"; } } } } } $line = getnextline; } print OUTFILE "\n"; } if ($onlist==1) { print OUTFILE "</table><br>\n"; } if ($onlist==0) { @otherdnames = (@otherdnames,$filename); } if ($opt_f) { closemainfile; } } if (!$opt_f) { closemainfile; } if ($opt_o) { # output all filenames sorted foreach $key (sort { lc($a) cmp lc($b) } keys %outfile2lines) { print OUTFILE2 $outfile2lines{$key} } print OUTFILE2 "</table><br>\n"; } if (($opt_o) && ($nooffiles == $#otherdnames+1)) { print OUTFILE2 "No file revisions.<br>\n"; } if (($#otherdnames>=0) && ($opt_o)) { print OUTFILE2 "<br><hr><h3 align=center>Unchanged</h3>\n"; if ($#otherdnames>=0) { print OUTFILE2 "<table border=0 cellspacing=1 cellpadding=3 bgcolor=\"$cellcolor\" width=\"100%\">\n"; for ($ii=0;$ii<=$#otherdnames;$ii++) { print OUTFILE2 "<tr><td><font size=\"-1\">$otherdnames[$ii]</font></td></tr>\n"; } print OUTFILE2 "</table><br>\n"; } else { print OUTFILE2 "All files have revisions.<br>\n"; } } # Lets wrap up OUTFILE2 if ($opt_o) { print OUTFILE2 "</body>\n"; print OUTFILE2 "</html>\n"; close(OUTFILE2); } # Found a bad one....... This should NOT happen if ($foundbadone == 1) { print STDERR "\ncvs2html found some files that was no part of CVS\n\n"; } if ($frames == 1) { print OUTFILE4 "<table border=0 cellspacing=1 cellpadding=3 bgcolor=\"$cellcolor\" width=\"100%\">\n"; for ($ddd=0;$ddd<=$#alldirs;$ddd++) { ($currentdir) = $alldirs[$ddd] =~ /^\.\/(.*)$/; $convdir = $currentdir; $convdir =~ tr/\//_/; if (length($currentdir)==0) { $currentdir='.'; $convdir = ""; } else { $convdir = '_'.$convdir; } chop($ldir = $alldirs[$ddd]); if (length($ldir) == 2) { $ldir =""; } print OUTFILE4 "<tr><td><a href=\"".$outfilename.$convdir."__lfu.html\">[$rootdir]$ldir</a></td></tr>\n"; } print OUTFILE4 "</table><br>\n"; } print OUTFILE4 html_footer(""); print OUTFILE4 "</noframes>\n"; print OUTFILE4 "</frameset>\n"; print OUTFILE4 "</html>\n"; close(OUTFILE4);}if ($dochrono) { $coutref = $outdirname."/".$chronooutname; open(CHRONOFILE,">$coutref"); if(defined($opt_V) && $opt_V>0) { print STDOUT "Generate chrono file\n"; } print CHRONOFILE html_header("CVS time sorted logs"); if ($frames == 0) { print CHRONOFILE '<a href="'.$outfilename.'.html" target="_top">Back to main page</a><p>'; } #print "Sorting the logfiles\r"; @cindex = sort sorter @chronoindex; #print "Done sorting the logfiles\n"; if ($frames == 1) { print CHRONOFILE "<table border=\"0\" width=\"100%\" bgcolor=\"$cellcolor\" cellspacing=\"1\" cellpadding=\"3\">"; printf(CHRONOFILE "<tr><td><b>%s</b></td> <td><b>%s</b></td> <td><b>%s</b></td> <td><b>%s</b></td></tr>\n","Time ","Revision","Author","Filename"); } else { printf(CHRONOFILE "<br><tr><br>\n%20s %8s %10s %s<br><hr>\n","Time ","Revision","Author","Filename"); } $cclim = $chronocounter; $cindexlow=0; if ($opt_N>0) { if ($opt_N-1<$chronocounter) { $cclim = $opt_N-1; $cindexlow = $chronocounter+1-$opt_N; $cctxt = " and only the last $opt_N changes are shown."; } } if ($cindexlow<0) { $cindexlow=0; } if ($opt_p) { for ($ii=$cindexlow;$ii<=$chronocounter;$ii++) { if ($opt_c) { $cind = $ii; } else { $cind = $chronocounter-$ii+$cindexlow; } $index = $cindex[$cind]; if(defined($opt_V) && $opt_V>1) { print STDOUT " $chrononame[$index]\n"; } @lcvslog = `$cvsLocation log -N -r$chronoversion[$index] "$chrononame[$index]"`; @llcvslog = (); $headerstill = -1; foreach $jj (0 .. ($#lcvslog-1)) { if ($headerstill == 0) { $_=$lcvslog[$jj]; s/&/&/g; s/\"/"/g; s/</</g; s/>/>/g; @llcvslog = (@llcvslog,$_); } else { $headerstill = $headerstill - 1; if ($lcvslog[$jj] =~ '----------------------------') { $headerstill = 2; } } } $lcvslogar[$index] = join('<br>',@llcvslog); if (length($lcvslogar[$index])<2) { $lcvslogar[$index] = "<i>(Empty log)</i>"; } } } for ($ii=$cindexlow;$ii<=$chronocounter;$ii++) { if ($opt_c) { $cind = $ii; $cind2 = $ii+1; } else { $cind = $chronocounter-$ii+$cindexlow; $cind2 = $cind-1; } $index = $cindex[$cind]; $index2 = $cindex[$cind2]; $ccc = '<A HREF="'.$chronolinknames[$index].'">'.$chrononame[$index]."</a>"; if ($frames==0) { printf(CHRONOFILE "%20s %8s %10s %s<br>\n",$chronoshowtime[$index],$chronoversion[$index],$chronoauthor[$index],$ccc); } else { printf(CHRONOFILE "<tr><td><b>%s</b></td> <td>%s</td> <td>%s</td> <td>%s</td></tr>\n",$chronoshowtime[$index],$chronoversion[$index],$chronoauthor[$index],$ccc); if ($opt_p) { if ($ii == $chronocounter){ printf(CHRONOFILE "<tr><td COLSPAN=4>\n"); print CHRONOFILE $lcvslogar[$index]; printf(CHRONOFILE "</td></tr>\n"); } elsif (($lcvslogar[$index] ne $lcvslogar[$index2]) || (abs($chronotimesince0[$index]-$chronotimesince0[$index2]))>$commit_smalltimedifference) { printf(CHRONOFILE "<tr><td COLSPAN=4>\n"); print CHRONOFILE $lcvslogar[$index]; printf(CHRONOFILE "</td></tr>\n"); } } } } if ($frames == 1) { print CHRONOFILE "</table>\n"; } else { print CHRONOFILE "<hr>\n"; } if ($frames == 0) { print CHRONOFILE '<p><a href="'.$outfilename.'.html" target="_top">Back to main page</a><p>'; } $stradd=""; if ($cutdate>"00000000") { $stradd.=" leaving out any log message prior to $cutyearformat2 $revisionlimitertext"; } print CHRONOFILE html_footer($stradd.$cctxt); #Wrap up the file print CHRONOFILE "\n</body>\n</html>\n"; close(CHRONOFILE);# We must report that a new file has been made @listhtmlnames = (@listhtmlnames,$coutref);}# Print status about which files have been generated# all diffs are under *_diff/ directory# files ending on "__rf" are those displayed in the right frame (the ones showing the revision history)# files ending on "__lfu" are those displayed in the upper part of the left frame# files ending on "__lfl" are those displayed in the lower part of the left frame#if(defined($opt_V) && $opt_V>0) { print STDOUT "cvs2html has generated the following files :\n"; @ll=sort(@listhtmlnames); for ($ff=0;$ff<=$#listhtmlnames;$ff++) { print " $ll[$ff]\n"; } print "\n";}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -