[svn r5977] Modified in anticipation of 1626 merge.

Added knowledge of parent cave to entrances.
This commit is contained in:
sb476
2004-05-07 16:50:43 +02:00
parent a7b159f21b
commit 389898b4f2

View File

@@ -42,6 +42,8 @@ print INDXAL << "END";
<h1>Kataster Gruppe 1623:<br />Loser Augst-Eck - INDEX</h1> <h1>Kataster Gruppe 1623:<br />Loser Augst-Eck - INDEX</h1>
<p>Note that <a href="1626/index.htm">information on caves in the adjacent area 1626 (Rauher - Sch&ouml;nberg)</a> is to be found elsewhere.</p>
<table border="0" frame="void"> <table border="0" frame="void">
END END
@@ -58,7 +60,7 @@ chdir "..";
# While loop which reads in each line of csv file # While loop which reads in each line of csv file
while (<CSV>) { while (<CSV>) {
chomp; chomp;
do_this_line($_, "cave"); do_this_line($_);
} }
# Finish writing index file # Finish writing index file
@@ -101,20 +103,24 @@ print "Information: Done\n";
# Process a line of the CSV file # Process a line of the CSV file
# First argument is contents of line to process # First argument is contents of line to process
# Second argument is "cave" or "entrance" # 2nd arg is the Kataster number of the cave an entrance belongs to (optional)
# 3rd arg is the Kataster number of the cave an entrance belongs to (optional) # 3rd arg is the Other number of the cave an entrance belongs to (optional)
# 4th arg is the Other number of the cave an entrance belongs to (optional) # 4th arg is the basename of the cave an entrance belongs to (optional)
# Returns nothing # Returns nothing
sub do_this_line { sub do_this_line {
# Split single line into all the fields # Split single line into all the fields
my ($kat_num, $kat_status, $ents, $other_number, $mult_ents, $file, $linkfile, $name, $unofficial_name, $comment, $area, $explorers, $u_description, $equipment, $qmlist, $katstatus, $references, $u_centre_line, $u_drawn_survey, $survex_file, $length, $depth, $extent, $header, $footer, $notes, $ent_name, $tag_punkt, $other_punkt, $desc_other_punkt, $exact_punkt, $fix_type, $gpspresa, $gpspostsa, $northing, $easting, $altitude, $bearings, $map, $location, $approach, $ent_desc, $ent_photo, $marking) = &parse_csv($_[0]); my ($kat_num, $kat_status, $ents, $other_number, $mult_ents, $file, $linkfile, $name, $unofficial_name, $comment, $area, $explorers, $u_description, $equipment, $qmlist, $katstatus, $references, $u_centre_line, $u_drawn_survey, $survex_file, $length, $depth, $extent, $header, $footer, $notes, $ent_name, $tag_punkt, $other_punkt, $desc_other_punkt, $exact_punkt, $fix_type, $gpspresa, $gpspostsa, $northing, $easting, $altitude, $bearings, $map, $location, $approach, $ent_desc, $ent_photo, $marking) = &parse_csv($_[0]);
my $parents_name;
# If we have been called to process an entrance, we may have been given the cave's Kataster number or Other number # If we have been called to process an entrance, we may have been given the cave's Kataster number or Other number
if ($_[2] and ! $kat_num) { if ($_[1] and ! $kat_num) {
$kat_num = $_[2]; $kat_num = $_[1];
} }
if ($_[3] and ! $other_number) { if ($_[2] and ! $other_number) {
$other_number = $_[3]; $other_number = $_[2];
}
if ($_[3]) {
$parents_name = $_[3];
} }
# Generate $linkid which will be kataster no., or other no. if no kataster no. present. Per HTML4 (and XHTML etc.) ID and NAME tokens must begin with alpha characters - hence "id" prepend # Generate $linkid which will be kataster no., or other no. if no kataster no. present. Per HTML4 (and XHTML etc.) ID and NAME tokens must begin with alpha characters - hence "id" prepend
@@ -133,7 +139,7 @@ sub do_this_line {
$linkid =~ s/ /_/; $linkid =~ s/ /_/;
$linkid = lc($linkid); $linkid = lc($linkid);
# Determine the number of directorys deep the caves main page is at in order to link to area descriptions and indxal # Determine the number of directorys deep the cave's main page is, in order to link to area descriptions and indxal
my $toroot = 'Q'; # hey; it's magic my $toroot = 'Q'; # hey; it's magic
my $counter = ($file =~ tr/\///); my $counter = ($file =~ tr/\///);
while ($counter) { while ($counter) {
@@ -142,8 +148,8 @@ sub do_this_line {
} }
$toroot =~ s/Q\///; $toroot =~ s/Q\///;
# If it's a cave, then insert it in the index file # If it's not an entrance, and it's not in 1626, insert it in the index file
if ($_[1] eq "cave") { if ($mult_ents !~ /entrance/ && $area ne 1626) {
my $e = $ents; my $e = $ents;
$e =~ s/ +/&nbsp;/g; $e =~ s/ +/&nbsp;/g;
print INDXAL "<tr><td><a name=\"$linkid\">$kat_num $other_number"; print INDXAL "<tr><td><a name=\"$linkid\">$kat_num $other_number";
@@ -211,7 +217,11 @@ sub do_this_line {
END END
if ($kat_num) { if ($kat_num) {
print FILE "<title>1623:$kat_num"; if ($area ne 1626) {
print FILE "<title>1623:$kat_num";
} else {
print FILE "<title>1626:$kat_num";
}
} else { } else {
print FILE "<title>$other_number"; print FILE "<title>$other_number";
} }
@@ -346,8 +356,9 @@ END
print FILE "\n\n<!-- LINKS -->\n<hr /><ul>\n"; print FILE "\n\n<!-- LINKS -->\n<hr /><ul>\n";
if ($_[1] eq "entrance") { if ($mult_ents =~ /entrance/) {
print FILE "<li><a href=\"javascript:history.back(1)\">Go Back (Javascript)</a></li>\n"; # ACCK! ACCK! Evil JavaScript! - this HAS to be done, for things like 78a, where the reader could have got there either via 78 OR 40 (and we have NO way of knowing print FILE "<li><a href=\"javascript:history.back(1)\">Go Back (Javascript)</a></li>\n"; # ACCK! ACCK! Evil JavaScript! - this HAS to be done, for things like 78a, where the reader could have got there either via 78 OR 40 (and we have NO way of knowing
print FILE "<li><a href=\"$parents_name\">Go up to overall cave description for this entrance</a></li>\n";
} }
# Find the area the cave is in, and add appropriate links # Find the area the cave is in, and add appropriate links
if ($area =~ /(1a|1b|1c|1d)/) { if ($area =~ /(1a|1b|1c|1d)/) {
@@ -384,6 +395,9 @@ END
if ($area =~ /11/) { if ($area =~ /11/) {
print FILE "<li><a href=\"$toroot\/augstb\/index.htm#$linkid\">Augstbach area index and description</a></li>\n"; print FILE "<li><a href=\"$toroot\/augstb\/index.htm#$linkid\">Augstbach area index and description</a></li>\n";
} }
if ($area =~ /1626/) {
print FILE "<li><a href=\"$toroot\/1626\/index.htm#$linkid\">1626 (Rauher - Sch&ouml;nberg) area index and description</a></li>\n";
}
# Finish writing to file # Finish writing to file
print FILE << "END"; print FILE << "END";
@@ -550,12 +564,12 @@ sub multi_ents {
if ($elinkfile) { # this is a link to another cave - add link to entrance into cave file but don't generate another file for the entrance if ($elinkfile) { # this is a link to another cave - add link to entrance into cave file but don't generate another file for the entrance
print FILE "<a href=\"$toroot\/$elinkfile\">$eents $eother_number</a> "; print FILE "<a href=\"$toroot\/$elinkfile\">$eents $eother_number</a> ";
do_this_line($e, "entrance", $kat_num, $other_number_no_brackets); do_this_line($e, $kat_num, $other_number_no_brackets);
} elsif ($efile) { # call ourselves recursively to create a file for the entrance } elsif ($efile) { # call ourselves recursively to create a file for the entrance
print FILE "<a href=\"$toroot\/$efile\">$eents $eother_number</a> "; print FILE "<a href=\"$toroot\/$efile\">$eents $eother_number</a> ";
close FILE; # perl filehandles are not recursively safe (when hacking at 4 in the morning). thus do this. close FILE; # perl filehandles are not recursively safe (when hacking at 4 in the morning). thus do this.
do_this_line($e, "entrance", $kat_num, $other_number_no_brackets); do_this_line($e, $kat_num, $other_number_no_brackets, (($_ = $file) =~ s/^.*(\/|\\)//ig) && $_);
open FILE, ">> $file" or die $!; open FILE, ">> $file" or die $!;
} else { # no entrance file needed, and no link to another cave } else { # no entrance file needed, and no link to another cave
print FILE "$eents $eother_number"; print FILE "$eents $eother_number";