#!/usr/local/bin/perl # convert lab --> t/labdata, t/labkeys # Each entry in labdata should start with 2 lines of the form: # # #KEY # Name of Lab # # or # # #KEY # Name of Lab # # where "#KEY" is a unique identifier, starting with a '#'. In the second case, the URL # must be on a single line (use canon.pl to merge lines). $labfilename = "labdata.html"; open KEYS, ">t/labkeys"; open LIST, ">t/labdata"; while(<>) { chop; ($key) = /^\s*\#(\w+)\s*$/; if ($key) { $_=<>; # read next line chop; ($tagtype, $address, $name) = /^\s*(.+)<.+/; if ($tagtype & $address & $name) { # is URL if ($tagtype ne "href") { print STDERR "unexpected tag type: >$tagtype<\n"; exit(1); } print LIST "
\n\n
$name\n"; } else { # name of lab $tagtype = "name"; $address = "$labfilename\#$key"; $name = $_; print LIST "
\n\n
$name\n"; } print KEYS "\#\#$key $name\n"; } else { # ordinary data line print LIST "
$_\n"; } }