[Bio] / KBaseTutorials / make_index.pl Repository:
ViewVC logotype

View of /KBaseTutorials/make_index.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Wed Jun 13 21:09:01 2012 UTC (7 years, 5 months ago) by olson
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +8 -3 lines
Update of the tutorial publication stuff.

#!/usr/bin/perl
use File::Basename;
use Data::Dumper;
use strict;

my %stuff;
my %tuts;
my %titles;
print "<h1>Index of Terms in KBase Tutorials</h1>\n";
while (<>) {
	chomp;
	my ($title, $tut, $h2, $term, $anchor) = split ("\t", $_);
	$titles{$tut} = $title;
	$tuts{$term} = $tut;
	if (!$stuff{$term}{$tut}{$h2}) {
		$stuff{$term}{$tut}{$h2} = $anchor;
	}
}
for my $term (sort (keys %stuff)) {
	print "<b>$term</b>\n";
	print "<ul>\n";
	for my $tut (sort keys (%{$stuff{$term}})) {
		print "<li>Tutorial: <i>$titles{$tut}</i>\n";
		print "<ul>\n";
		my $items = $stuff{$term}{$tut};
		foreach my $h2 (sort { my($an) = $items->{$a} =~ /(\d+)$/;
				       my($bn) = $items->{$b} =~ /(\d+)$/;
				       $an <=> $bn } keys(%{$stuff{$term}{$tut}})) {
			my $anchor = $stuff{$term}{$tut}{$h2};
            my $fname = basename($tut);
			#print "<li><a href=\"http://bioseed.mcs.anl.gov/~disz/$fname#$anchor\">$h2</a>\n";
			print "<li><a href=\"$fname#$anchor\">$h2</a>\n";
		
		}
		print "</ul>\n";
	}
	print "</ul>\n";
}




MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3