From 8cc112ac681acdea34a7f54cdc2e0f96bbf999d1 Mon Sep 17 00:00:00 2001 From: ExpoOnServer <devnull@localhost> Date: Thu, 18 Aug 2011 10:34:14 +0100 Subject: [PATCH 1/2] dge up a 258 version of this script. It's clearly madness having one per cave. Troggle should sort this anyway. --- smkridge/258/tablize-qms.pl | 184 ++++++++++++++++++++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 smkridge/258/tablize-qms.pl diff --git a/smkridge/258/tablize-qms.pl b/smkridge/258/tablize-qms.pl new file mode 100644 index 000000000..2f026bac3 --- /dev/null +++ b/smkridge/258/tablize-qms.pl @@ -0,0 +1,184 @@ +#!/usr/bin/perl -w +use strict; +use Getopt::Long; + +((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 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<!-- *** This file is auto-generated by $progname - edit $ARGV[0] instead --> +<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> + +<head> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> +<link rel="stylesheet" type="text/css" href="../../css/main2.css" /> +<title>1623/204 Question Mark List</title> +</head> + +<body> + +<h1>Tunnocksschacht Question Mark list</h1> + +<div> +<a href="#qmextant">Extant QM's</a> + -- <a href="#qmdone">Finished QM's</a> + -- <a href="258.html">258 index</a> +</div> +<hr /> +<h2>Conventions</h2> + +<p>For question mark list conventions, see <a href="../../qm.html">here</a>.</p> + +<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 258 index page</a></li> +<li><a href="../../smkridge/index.html#id258">Schwarzmooskogel ridge area index and description</a></li> +<li><a href="../../indxal.htm#id258">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); +} From aa8f9ffa6e7ceff37f9948040e94119bacf9b4f7 Mon Sep 17 00:00:00 2001 From: Aiora Zabala <az296@cam.ac.uk> Date: Thu, 18 Aug 2011 21:40:22 +0200 Subject: [PATCH 2/2] link & style fixes --- index.htm | 17 ++++------------- infodx.htm | 2 +- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/index.htm b/index.htm index ab63d3db8..707f95165 100644 --- a/index.htm +++ b/index.htm @@ -4,18 +4,9 @@ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>CUCC's Austria expeditions</title> <link rel="stylesheet" type="text/css" href="css/main2.css" /> -<style type="text/css"> -<!-- -.style1 { - font-size: small; - font-weight: bold; - font-style: italic; -} ---> -</style> </head> -<body> -<h1>CUCC in Austria <a href="years/1976/report.htm">1976</a>-<a href="years/2010">2010</a></h1> +<body id="homepage"> +<h1>CUCC in Austria <a href="years/1976/report.htm">1976</a>-<a href="years/2011/index.html">2011</a></h1> <p style="text-align: center">Welcome to the website of the Cambridge University Caving Club expeditions to Austria.</p> @@ -23,14 +14,14 @@ Club expeditions to Austria.</p> <div style="text-align: center"><img src="images/stone-bridge-view.jpg" width="399" height="260" alt="Austria panorama" /></div> <div style="text-align: center; position: relative;"> - <p><a href="intro.html">Introduction</a> | + <p><a href="intro.htm">Introduction</a> | <a href="infodx.htm">Main index</a> | <a href="indxal.htm">Cave index</a> | <a href="handbook/index.htm">Expedition handbook</a><br /> <a href="pubs.htm">Published reports</a> | <a href="areas.htm">Area description</a> | - <a href="/">CUCC website</a> + <a href="http://www.srcf.ucam.org/caving/wiki" target="_blank">CUCC website</a> </p> </div> </body> diff --git a/infodx.htm b/infodx.htm index 6271969e5..45982b857 100644 --- a/infodx.htm +++ b/infodx.htm @@ -69,7 +69,7 @@ <li>The Expo <a href="index.htm">Home page</a></li> <li><a href="travel.htm">How to get to Expo</a></li> <li><a href="dclaim.htm">Independent visitors' info</a></li> -<li><a href="intro.html">Introduction</a></li> +<li><a href="intro.htm">Introduction</a></li> <li>The Austrian <a href="katast.htm">Kataster</a> or cave catalogue</li> <li><a href="kitlist.html">Kit list</a></li> <li><a href="links.htm">Links</a> to other relevant websites</li>