[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: |
Sun, 02 May 2010 17:20:33 +0000 |
CVSROOT: /web/www
Module name: www
Changes by: Karl Berry <karl> 10/05/02 17:20:33
Modified files:
prep/wrappers-and-scripts: ftp_convert.pl
Log message:
formatting
CVSWeb URLs:
http://web.cvs.savannah.gnu.org/viewcvs/www/prep/wrappers-and-scripts/ftp_convert.pl?cvsroot=www&r1=1.11&r2=1.12
Patches:
Index: ftp_convert.pl
===================================================================
RCS file: /web/www/www/prep/wrappers-and-scripts/ftp_convert.pl,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- ftp_convert.pl 27 Oct 2008 19:57:18 -0000 1.11
+++ ftp_convert.pl 2 May 2010 17:20:25 -0000 1.12
@@ -1,5 +1,5 @@
#!/usr/local/bin/perl -w
-# $Id: ftp_convert.pl,v 1.11 2008/10/27 19:57:18 karl Exp $
+# $Id: ftp_convert.pl,v 1.12 2010/05/02 17:20:25 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
@@ -29,45 +29,39 @@
my $print_current_output=1;
my @ftp_sites=();
-#print <<EOT;
-# <HEAD>
-# <TITLE>How to get GNU Software by Internet FTP or by UUCP.</TITLE>
-# </HEAD>
-# <BODY>
-#EOT
-
$_ = <>;
die "Incorrect format, start with How to get." unless /^How to get/;
$state = 0;
+
while (<>) {
# Take care of headers
chomp;
- $print_current_output=1;
+ $print_current_output = 1;
if (/^(\*+)\s*/) {
- $state=0;
- $headlvl=length($+) + 2;
+ $state = 0;
+ $headlvl = length ($+) + 2;
if ($headlvl >= 7) {
die "Header depth exceeds HTML capabilities.";
}
- $printstr=$';
- $printstr=~s/(address@hidden)/<a href="mailto:$1"><$1><\/a>/g;
+ $printstr = $';
+ $printstr =~ s/(address@hidden)/<a href="mailto:$1"><$1><\/a>/g;
if ($printstr eq "GNU mirror list") {
- $start_of_ftp_list=1;
- $last_place="";
+ $start_of_ftp_list = 1;
+ $last_place = "";
} else {
if ($start_of_ftp_list) {
if ($list_open) {
print "</li>\n</ul>\n";
- $list_open=0;
+ $list_open = 0;
}
print "</li>\n</ul>\n";
}
- $start_of_ftp_list=0;
+ $start_of_ftp_list = 0;
}
(my $anchor_id = $printstr) =~ tr/ A-Z/_a-z/;
print qq!<a id="$anchor_id"></a>\n!;
@@ -75,7 +69,7 @@
if ($start_of_ftp_list) {
print "<ul>\n";
}
- $print_current_output=0;
+ $print_current_output = 0;
next;
}
@@ -121,34 +115,35 @@
next;
}
+
if ($start_of_ftp_list == 1) {
if (/^(.+?):\s?$/ ) {
# Continent
if ($list_open) {
print "</li>\n</ul>\n</li>\n";
- $list_open=0;
+ $list_open = 0;
}
$last_place="";
print "<li>$1\n";
- $print_current_output=0;
+ $print_current_output = 0;
next;
}
if (/^(.+?)\s+\-\s+(\S+.*)$/) {
#Country/City
- $place=$1;
- @ftp_sites=();
- @ftp_sites=split /,/,$2;
+ $place = $1;
+ @ftp_sites = ();
+ @ftp_sites = split /,/,$2;
if ((!$last_place) or ($place ne $last_place)) {
if ($last_place) {
if ($place ne $last_place) {
- $list_open=0;
+ $list_open = 0;
print " </li>\n</ul>\n";
}
}
- $last_place=$place;
- $list_open=1;
+ $last_place = $place;
+ $list_open = 1;
print " <ul>\n";
print " <li>$place\n";
}
@@ -167,7 +162,7 @@
};
print " </ul>\n";
}
- $print_current_output=0;
+ $print_current_output = 0;
next;
}
@@ -177,6 +172,7 @@
print "<p>\n";
$state = 1;
}
+
if (/@/) {
s/(address@hidden)/<a href="mailto:$1"><$1><\/a>/g;
next;
@@ -185,6 +181,7 @@
s/(\b\S*http:\S*\b)([\.\s]*)/<a href="$1">$1<\/a>$2/g;
next;
}
+
if (/ftp:\S+/) {
s/(\b\S*ftp:\S*\b)([\.\s]*)/<a href="$1">$1<\/a>$2/g;
next;
@@ -192,6 +189,7 @@
s/(\b\S*ftp\.\S*[\[\]]*\b)(\.*\s*)/<a href="ftp:\/\/$1">$1<\/a>$2/g;
next;
}
+
} continue {
if ($print_current_output) {
print "$_\n";
- www/prep/wrappers-and-scripts ftp_convert.pl,
Karl Berry <=