Mercurial > hg > lukkari
changeset 54:0d574e3248b5
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 23 Oct 2012 19:00:19 +0300 |
parents | b2f45dd616bc |
children | 656b2a22b945 |
files | parsedata.pl |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/parsedata.pl Tue Oct 23 18:04:15 2012 +0300 +++ b/parsedata.pl Tue Oct 23 19:00:19 2012 +0300 @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # # Fetch and parse HTML format class timetable into more sane formats -# (C) Copyright 2010-2011 Matti Hämäläinen <ccr@tnsp.org> +# (C) Copyright 2010-2012 Matti Hämäläinen <ccr@tnsp.org> # use strict; use Data::Dumper; @@ -219,7 +219,7 @@ die("Usage: $0 [options] <filename> -php Output a PHP include file with data in arrays (default) - -xml Output XML. + -xml Output a simple XML file. -o <filename> Set output filename. Default is to use stdout. @@ -284,9 +284,10 @@ foreach my $n (@{$d}) { my $l = $$n{"nodes"}[0]{"nodes"}; if (defined($l) && $$n{"args"} =~ /colspan=6\s+rowspan=(\d+)/) { - my $chours = $1 / 2; + my $chours = $1 / 2; # The table is actually in half cells my $cdata = []; my $cgrouped = 0; + foreach my $h (@{$l}) { if (defined($$h{"nodes"})) { foreach my $b (@{$$h{"nodes"}}) { @@ -364,12 +365,12 @@ "\$classInfo = array(\n". " \"general\" => array(".join(", ", map { "\"".escape($_)."\""; } @{$class{"info"}})."),\n". " \"info\" => array(".join(", ", map { "\"".escape(html_collapse($_, 1))."\""; } @{$class{"data"}})."),\n". - " \"info_tags\" => array(".join(", ", map { "\"".escape(html_collapse($_, 0))."\""; } @{$class{"data"}})."),\n". + " \"tags\" => array(".join(", ", map { "\"".escape(html_collapse($_, 0))."\""; } @{$class{"data"}})."),\n". " \"maxdays\" => $maxDays,\n". " \"maxhours\" => $maxHours,\n". ");\n\n"; - print "\$classDefs = array(\n"; + print "\$classHourDefs = array(\n"; foreach my $cid (sort { $a <=> $b } keys %{$hourDefs}) { print " $cid => array("; foreach my $key (keys %{$$hourDefs{$cid}}) {