mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2024-11-22 23:31:56 +00:00
198 lines
4.5 KiB
Perl
198 lines
4.5 KiB
Perl
#!/usr/bin/perl -w
|
|
use strict;
|
|
use Getopt::Long;
|
|
|
|
# 204 Question Mark list
|
|
((my $progname = $0) =~ s/^.*(\/|\\)//ig); # basename $0
|
|
|
|
# Parse options
|
|
my $no_verbose_progress = 0;
|
|
my $usage = 0;
|
|
GetOptions('quiet' => \$no_verbose_progress, # be quiet
|
|
'help|?' => \$usage # help!
|
|
);
|
|
|
|
# Print usage
|
|
if ($usage) {
|
|
usage();
|
|
}
|
|
|
|
unless ($ARGV[0]) {
|
|
print "Specify a CSV file name as the program's argument (e.g. qm.csv)\n";
|
|
usage();
|
|
}
|
|
|
|
open (CSV, "< $ARGV[0]");
|
|
|
|
# Start writing table file, and write table header
|
|
open TABLE, "> qm.html" or die $!;
|
|
print TABLE << "END";
|
|
<!DOCTYPE html">
|
|
<!-- *** This file is auto-generated by $progname - edit $ARGV[0] instead -->
|
|
<html lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<link rel="stylesheet" type="text/css" href="/css/main2.css" />
|
|
<title>1623/204 Question Mark List</title>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>Steinbrückenhöhle Question Mark list</h1>
|
|
<div>
|
|
<a href="#qmextant">Extant QM's</a>
|
|
-- <a href="#qmdone">Finished QM's</a>
|
|
-- <a href="204.html">204 index</a>
|
|
</div>
|
|
<hr />
|
|
<h2>Conventions</h2>
|
|
|
|
<p>For question mark list conventions, see <a href="/handbook/survey/qm.html">here</a>.</p>
|
|
|
|
<h2>Area codes</h2>
|
|
|
|
<table>
|
|
<tr><td>Aris</td><td>Ariston Series </td></tr>
|
|
<tr><td>Insig</td><td>Insignificant Chamber and Bonsai Crawl</td></tr>
|
|
<tr><td>NE</td><td>Near End</td></tr>
|
|
<tr><td>NPNG</td><td>No Pain No Gain </td></tr>
|
|
<tr><td>Tree</td><td>Trunk route from The Colonnade via Treeumphant Passage to Cave Tree Chamber</td></tr>
|
|
<tr><td>WE</td><td>White Elephant Series</td></tr>
|
|
<tr><td>Wolp</td><td>Wolpertinger Way and 110 A Day level</td></tr>
|
|
<tr><td>PD</td><td>Pleasure Dome and pitches below</td></tr>
|
|
<tr><td>Sw</td><td>Swings and Roundabouts</td></tr>
|
|
</table>
|
|
|
|
<h2>Question Marks</h2>
|
|
|
|
END
|
|
|
|
<CSV>; # starting to read in csv file, eat header line
|
|
|
|
my ($number, $grade, $area, $desc, $ref, $station, $completion);
|
|
my $incomplete="";
|
|
my $complete="";
|
|
my $templine;
|
|
my $colon;
|
|
my @stationbits;
|
|
print "Progress: *";
|
|
|
|
my $thisyear = -1;
|
|
my $qmyear;
|
|
|
|
# While loop which reads in each line of csv file
|
|
while (<CSV>) {
|
|
chomp;
|
|
# Split single line into all the fields
|
|
($number, $grade, $area, $desc, $ref, $station, $completion) = &parse_csv($_);
|
|
|
|
if (!$completion) { $completion = ""; }
|
|
$completion =~ s/\r//;
|
|
if (!$station) { $station = ""; }
|
|
if (!$ref) { $ref = ""; }
|
|
if (!$grade) { $grade = ""; }
|
|
if (!$desc) { $desc = ""; }
|
|
if (!$area) { $area = ""; }
|
|
|
|
if (($completion ne "") and ($ref ne ""))
|
|
{
|
|
print "\n?? Backlink for completed $number\n";
|
|
print "Ref is '$ref' and completion is '$completion'\n";
|
|
}
|
|
$qmyear = substr($number, 1, 4);
|
|
if($qmyear != $thisyear)
|
|
{
|
|
$complete = "$complete\n<h3>$qmyear</h3>\n";
|
|
$incomplete = "$incomplete\n<h3>$qmyear</h3>\n";
|
|
$thisyear = $qmyear;
|
|
}
|
|
# Last field of CSV file can have weird form-feeds etc. Kill them
|
|
|
|
|
|
# Construct XHTML line
|
|
if ($ref) {
|
|
$templine = "<dt><a href=\"$ref#q$number\" id=\"$number\">$number</a>";
|
|
} else {
|
|
$templine = "<dt>$number";
|
|
}
|
|
|
|
$templine = "$templine $grade</dt><dd>";
|
|
|
|
$colon = "";
|
|
if ($completion || $desc) {
|
|
$colon = ": ";
|
|
}
|
|
|
|
@stationbits = split(/\./, $station);
|
|
if ($#stationbits > 0)
|
|
{
|
|
$station = "$stationbits[-2].$stationbits[-1]";
|
|
}
|
|
if ($station) {
|
|
if ($area) {
|
|
$templine = "$templine$area, near $station$colon";
|
|
} else {
|
|
$templine = "${templine}Near $station$colon";
|
|
}
|
|
} elsif ($area) {
|
|
$templine = "$templine$area$colon"
|
|
}
|
|
|
|
if ($completion) {
|
|
$complete = "$complete$templine$completion</dd>\n";
|
|
} else {
|
|
$incomplete = "$incomplete$templine$desc</dd>\n";
|
|
}
|
|
|
|
print "*";
|
|
}
|
|
|
|
print TABLE << "END";
|
|
<h3><a id="qmextant">Extant QMs</a></h3>
|
|
|
|
<dl>
|
|
$incomplete
|
|
</dl>
|
|
|
|
<h3><a id="qmdone">Completed QMs</a></h3>
|
|
|
|
<dl>
|
|
$complete
|
|
</dl>
|
|
|
|
<hr />
|
|
<ul>
|
|
<li><a href="204.html">Back to 204 index page</a></li>
|
|
<li><a href="../../smkridge.html#id204">Schwarzmooskogel ridge area index and description</a></li>
|
|
<li><a href="../../indxal.htm#id204">Full Index</a></li>
|
|
<li><a href="../../areas.htm">Other Areas</a></li>
|
|
<li><a href="../../index.htm">Back to Expedition Intro page</a></li>
|
|
</ul>
|
|
</body>
|
|
</html>
|
|
END
|
|
|
|
close TABLE;
|
|
print "\nInformation: Done\n";
|
|
|
|
# Parse the CSV file
|
|
sub parse_csv {
|
|
my @fields=split /\t/;
|
|
my @unquoted=();
|
|
foreach $_ (@fields) {
|
|
$_ =~ s/\"//g;
|
|
push (@unquoted, $_);
|
|
}
|
|
return @unquoted;
|
|
}
|
|
|
|
# Usage
|
|
sub usage {
|
|
print << "EOF";
|
|
USAGE: $progname [-options] <CSV file>
|
|
-q, --quiet Be quiet about progress
|
|
-h, --help Show this message
|
|
EOF
|
|
exit(0);
|
|
}
|