[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
www/prep/wrappers-and-scripts ftp_convert.pl
From: |
Karl Berry |
Subject: |
www/prep/wrappers-and-scripts ftp_convert.pl |
Date: |
Mon, 27 Oct 2008 19:57:51 +0000 |
CVSROOT: /web/www
Module name: www
Changes by: Karl Berry <karl> 08/10/27 19:57:51
Modified files:
prep/wrappers-and-scripts: ftp_convert.pl
Log message:
reindent with spaces, avoid { solo lines
CVSWeb URLs:
http://web.cvs.savannah.gnu.org/viewcvs/www/prep/wrappers-and-scripts/ftp_convert.pl?cvsroot=www&r1=1.10&r2=1.11
Patches:
Index: ftp_convert.pl
===================================================================
RCS file: /web/www/www/prep/wrappers-and-scripts/ftp_convert.pl,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- ftp_convert.pl 27 Oct 2008 13:33:42 -0000 1.10
+++ ftp_convert.pl 27 Oct 2008 19:57:18 -0000 1.11
@@ -1,12 +1,12 @@
#!/usr/local/bin/perl -w
-# $Id: ftp_convert.pl,v 1.10 2008/10/27 13:33:42 karl Exp $
+# $Id: ftp_convert.pl,v 1.11 2008/10/27 19:57:18 karl Exp $
#
# Converts the FTP file to a html file - just prints on the standard out
# and it is the responsibility of who ever running this to redirect to a
# flat_file. Also standard GNU HTML header and trailer needs to be added to
# this page. See the Makefile.
#
-# Original Script Written by : address@hidden
+# Original Script Written by address@hidden
#
# 01/02/1999 - Murali - Added support for http sites on the ftp list
# Also fixed the bug with <tt></tt>
@@ -47,29 +47,21 @@
$print_current_output=1;
- if (/^(\*+)\s*/)
- {
+ if (/^(\*+)\s*/) {
$state=0;
$headlvl=length($+) + 2;
- if ($headlvl >= 7)
- {
+ if ($headlvl >= 7) {
die "Header depth exceeds HTML capabilities.";
}
$printstr=$';
$printstr=~s/(address@hidden)/<a
href="mailto:$1"><$1><\/a>/g;
- if ($printstr eq "GNU mirror list")
- {
+ if ($printstr eq "GNU mirror list") {
$start_of_ftp_list=1;
$last_place="";
- }
- else
- {
-
- if ($start_of_ftp_list)
- {
- if ($list_open)
- {
+ } else {
+ if ($start_of_ftp_list) {
+ if ($list_open) {
print "</li>\n</ul>\n";
$list_open=0;
}
@@ -80,8 +72,7 @@
(my $anchor_id = $printstr) =~ tr/ A-Z/_a-z/;
print qq!<a id="$anchor_id"></a>\n!;
print "<h$headlvl>$printstr</h$headlvl>\n";
- if ($start_of_ftp_list)
- {
+ if ($start_of_ftp_list) {
print "<ul>\n";
}
$print_current_output=0;
@@ -89,8 +80,7 @@
}
# Is this a blank line?
- if (/^\s*$/)
- {
+ if (/^\s*$/) {
print "</ul>\n" if $state == 2;
print "</p>\n" if $state == 1;
$state = 0;
@@ -98,23 +88,19 @@
}
# Is this a text bulleted list?
- if (/^\t-/)
- {
- if ($state != 2)
- {
+ if (/^\t-/) {
+ if ($state != 2) {
print "<ul>\n";
$state = 2;
}
print " <li>";
s/^\t-//;
- if (/http:\S+/)
- {
+ if (/http:\S+/) {
s/(\b\S*http:\S*\b)([\.\s]*)/<a
href="$1">$1<\/a>$2/g;
next;
}
- if (/ftp\.\S+/)
- {
+ if (/ftp\.\S+/) {
s/(ftp\.\S*[\[\]]*(?=\s))(\.*\s*)/<a
href="ftp:\/\/$1">$1<\/a>$2/g;
next;
}
@@ -122,15 +108,12 @@
}
# Is this a filename sitting on its own?
- if (/^\t/)
- {
- if (/http:\S+/)
- {
+ if (/^\t/) {
+ if (/http:\S+/) {
s/(\b\S*http:\S*\b)([\.\s]*)/<a
href="$1">$1<\/a>$2/g;
next;
}
- if (/ftp\.\S+/)
- {
+ if (/ftp\.\S+/) {
s/(\b\S*ftp\.\S*[\[\]]*\b)(\.*\s*)/<a
href="ftp:\/\/$1">$1<\/a>$2/g;
next;
}
@@ -138,14 +121,10 @@
next;
}
- if ($start_of_ftp_list == 1)
- {
-
- if (/^(.+?):\s?$/ )
- {
+ if ($start_of_ftp_list == 1) {
+ if (/^(.+?):\s?$/ ) {
# Continent
- if ($list_open)
- {
+ if ($list_open) {
print "</li>\n</ul>\n</li>\n";
$list_open=0;
}
@@ -155,19 +134,15 @@
next;
}
- if (/^(.+?)\s+\-\s+(\S+.*)$/)
- {
+ if (/^(.+?)\s+\-\s+(\S+.*)$/) {
#Country/City
$place=$1;
@ftp_sites=();
@ftp_sites=split /,/,$2;
- if ((!$last_place) or ($place ne $last_place))
- {
- if ($last_place)
- {
- if ($place ne $last_place)
- {
+ if ((!$last_place) or ($place ne $last_place)) {
+ if ($last_place) {
+ if ($place ne $last_place) {
$list_open=0;
print " </li>\n</ul>\n";
}
@@ -179,8 +154,7 @@
}
print " <ul>\n";
- foreach $ftpsite (@ftp_sites)
- {
+ foreach $ftpsite (@ftp_sites) {
($actual_bits,$extra_bits) = ($ftpsite =~
/(\S+)(.*$)/);
if ($ftpsite =~ /(http:\S+)/ ) {
print " <li><a href=\"$1\">$1</a>\n";
@@ -199,36 +173,27 @@
# Well, we've covered everything else... I guess this is text.
# Now we add in URLs as necessary and send it off.
- if ($state == 0)
- {
+ if ($state == 0) {
print "<p>\n";
$state = 1;
}
- if (/@/)
- {
+ if (/@/) {
s/(address@hidden)/<a
href="mailto:$1"><$1><\/a>/g;
next;
}
- if (/http:\S+/)
- {
+ if (/http:\S+/) {
s/(\b\S*http:\S*\b)([\.\s]*)/<a href="$1">$1<\/a>$2/g;
next;
}
- if (/ftp:\S+/)
- {
+ if (/ftp:\S+/) {
s/(\b\S*ftp:\S*\b)([\.\s]*)/<a href="$1">$1<\/a>$2/g;
next;
-
- } elsif (/ftp\.\S+/)
- {
+ } elsif (/ftp\.\S+/) {
s/(\b\S*ftp\.\S*[\[\]]*\b)(\.*\s*)/<a
href="ftp:\/\/$1">$1<\/a>$2/g;
next;
}
-
-
} continue {
- if ($print_current_output)
- {
+ if ($print_current_output) {
print "$_\n";
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- www/prep/wrappers-and-scripts ftp_convert.pl,
Karl Berry <=