From 389898b4f2671fcbf557154732248af1966d9f7b Mon Sep 17 00:00:00 2001 From: sb476 Date: Fri, 7 May 2004 16:50:43 +0200 Subject: [PATCH] [svn r5977] Modified in anticipation of 1626 merge. Added knowledge of parent cave to entrances. --- noinfo/make-indxal4.pl | 44 ++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/noinfo/make-indxal4.pl b/noinfo/make-indxal4.pl index 1e7698220..998acb9df 100755 --- a/noinfo/make-indxal4.pl +++ b/noinfo/make-indxal4.pl @@ -42,6 +42,8 @@ print INDXAL << "END";

Kataster Gruppe 1623:
Loser Augst-Eck - INDEX

+

Note that information on caves in the adjacent area 1626 (Rauher - Schönberg) is to be found elsewhere.

+ END @@ -58,7 +60,7 @@ chdir ".."; # While loop which reads in each line of csv file while () { chomp; - do_this_line($_, "cave"); + do_this_line($_); } # Finish writing index file @@ -101,20 +103,24 @@ print "Information: Done\n"; # Process a line of the CSV file # First argument is contents of line to process -# Second argument is "cave" or "entrance" -# 3rd arg is the Kataster number of the cave an entrance belongs to (optional) -# 4th arg is the Other number of the cave an entrance belongs to (optional) +# 2nd 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 basename of the cave an entrance belongs to (optional) # Returns nothing sub do_this_line { # 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 $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 ($_[2] and ! $kat_num) { - $kat_num = $_[2]; + if ($_[1] and ! $kat_num) { + $kat_num = $_[1]; } - if ($_[3] and ! $other_number) { - $other_number = $_[3]; + if ($_[2] and ! $other_number) { + $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 @@ -133,7 +139,7 @@ sub do_this_line { $linkid =~ s/ /_/; $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 $counter = ($file =~ tr/\///); while ($counter) { @@ -142,8 +148,8 @@ sub do_this_line { } $toroot =~ s/Q\///; - # If it's a cave, then insert it in the index file - if ($_[1] eq "cave") { + # If it's not an entrance, and it's not in 1626, insert it in the index file + if ($mult_ents !~ /entrance/ && $area ne 1626) { my $e = $ents; $e =~ s/ +/ /g; print INDXAL "
$kat_num $other_number"; @@ -211,7 +217,11 @@ sub do_this_line { END if ($kat_num) { - print FILE "1623:$kat_num"; + if ($area ne 1626) { + print FILE "<title>1623:$kat_num"; + } else { + print FILE "<title>1626:$kat_num"; + } } else { print FILE "<title>$other_number"; } @@ -346,8 +356,9 @@ END 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=\"$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 if ($area =~ /(1a|1b|1c|1d)/) { @@ -384,6 +395,9 @@ END if ($area =~ /11/) { 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önberg) area index and description</a></li>\n"; + } # Finish writing to file 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 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 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. - 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 $!; } else { # no entrance file needed, and no link to another cave print FILE "$eents $eother_number";