зеркало из https://github.com/mozilla/gecko-dev.git
dawn@cannibal.mi.org:
yet another attempt at adding descriptions to directory listings. This time use the following search criterion for rcs variables which hopefully won't confuse cvs. /Id: $filename/ mozilla/README directory was confusing lxr. Added a check that README is a regular file before its displayed in the directory listing.
This commit is contained in:
Родитель
1b46e39ecd
Коммит
60ff38a615
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bonsaitools/bin/perl
|
||||
# $Id: source,v 1.9 1998/06/20 01:29:23 jwz Exp $
|
||||
# $Id: source,v 1.10 1998/06/23 01:01:11 jwz Exp $
|
||||
|
||||
# source -- Present sourcecode as html, complete with references
|
||||
#
|
||||
|
@ -29,24 +29,62 @@ use LXR::Common;
|
|||
use LXR::Config;
|
||||
|
||||
|
||||
# dme: Search the beginning of a source file for a short description
|
||||
# to be displayed in directory listings. Not all files have
|
||||
# them and the ones that do use different formats so there are
|
||||
# lots of ways to end up with junk. The basic format is: a file
|
||||
# name possibly followed by a colon or dash(es) with whitespace
|
||||
# strewn in followed by the description and maybe some stray comment
|
||||
# characters. Don't be confused by #includes or rcs comments
|
||||
# at the beginning of the file.
|
||||
# -dme
|
||||
sub fdescexpand {
|
||||
my $linecount=0;
|
||||
local $desc= "";
|
||||
|
||||
#ignore files that aren't source code
|
||||
if (!(
|
||||
($filename =~ /\.c$/) |
|
||||
($filename =~ /\.h$/) |
|
||||
($filename =~ /\.cc$/) |
|
||||
($filename =~ /\.cp$/) |
|
||||
($filename =~ /\.cpp$/) |
|
||||
($filename =~ /\.java$/)
|
||||
)){
|
||||
return("");
|
||||
}
|
||||
|
||||
if (open(FILE, $Path->{'real'}."/".$filename)) {
|
||||
while(<FILE>){
|
||||
if($linecount++ > 40) {
|
||||
last;
|
||||
}elsif (/Id: $filename/){
|
||||
#ignore cvs headers
|
||||
}elsif (/^#/){
|
||||
#ignore cpp directives
|
||||
}elsif (/$filename\s*- ?-*\s*/i){
|
||||
$desc = (split(/ $filename\s*- ?-*\s*/i))[1];
|
||||
if ($desc) {last};
|
||||
}elsif (/$filename\s*:\s*/i){
|
||||
$desc = (split(/ $filename\s*:\s*/i))[1];
|
||||
if ($desc) {last};
|
||||
}elsif (/$filename\s\s*/i){
|
||||
$desc = (split(/ $filename\s\s*/i))[1];
|
||||
if ($desc) {last};
|
||||
}
|
||||
}
|
||||
close(FILE);
|
||||
}
|
||||
if (!($desc)){
|
||||
return("");
|
||||
}
|
||||
|
||||
#strip trailing asterisks and "*/"
|
||||
$desc =~ s#\*/?\s*$##;
|
||||
|
||||
#htmlify the comments making links to symbols and files
|
||||
$desc = markupstring($desc, $Path->{'virt'});
|
||||
|
||||
$desc= "";
|
||||
# if (open(FILE, $Path->{'real'}."/".$filename)) {
|
||||
# while(<FILE>){
|
||||
# if(/$filename\s*--*\s*/i){
|
||||
# ($null, $desc) = split(/ $filename\s*--*\s*/i);
|
||||
# if ($desc) {last};
|
||||
# }elsif (/$filename\s*:\s*/i){
|
||||
# ($null, $desc) = split(/ $filename\s*:\s*/i);
|
||||
# if ($desc) {last};
|
||||
# }elsif (/$filename\s*/i){
|
||||
# ($null, $desc) = split(/ $filename\s*/i);
|
||||
# if ($desc) {last};
|
||||
# }
|
||||
# }
|
||||
# close(FILE);
|
||||
# }
|
||||
return($desc);
|
||||
}
|
||||
|
||||
|
@ -268,7 +306,8 @@ sub printfile {
|
|||
unless ($Path->{'file'}) {
|
||||
&printdir;
|
||||
|
||||
if (open(SRCFILE, $Path->{'real'}.README)) {
|
||||
if ( (-f $Path->{'real'}.README) &&
|
||||
(open(SRCFILE, $Path->{'real'}.README)) ) {
|
||||
print("<hr><pre>");
|
||||
&markupfile(\*SRCFILE, $Path->{'virt'}, 'README',
|
||||
sub { print shift });
|
||||
|
|
Загрузка…
Ссылка в новой задаче