#!/usr/bin/perl -w use HTML::CalendarMonthSimple; use Date::Calc qw(Date_to_Text); use strict; my $usage = q { Generates TUNA calendar and abstract pages. Use: When a speaker is confirmed, cd to the TUNA directory and make a file named yyyymmdd_lastnameofspeaker.tuna where yyyymmdd is the date of the talk, containing --------------------------------------------------- Name URL (or - if none available, even after googling) Institute URL of institute (or - if none available, even after googling) Title of talk Abstract --------------------------------------------------- Some samples are in test/. Each field is separated by at least one blank line, but multiple paragraphs in the abstract is OK. Then run updatetuna startmonth endmonth with startmonth and endmonth as integers (January = 1, December = 12), and it will fill index.html with style info ($header), general info ($frontmatter), calendars from startmonth to endmonth, and miscellaneous info ($endmatter). Obviously changes to the "fixed" info should be made here and/or in tunastyle.css, not in index.html! The $year variable below will also need to be updated annually. The old index.html will be moved to index.html.bkup, so don't run updatetuna again until you're sure the new updatetuna is OK! An abstract page will be made and linked for any new (or modified) .tuna file. Note that the abstract pages know if they are for MUNA, TUNA, WUNA, or FUNA. The first time you run it you will probably have to first install HTML::CalendarMonthSimple: % perl -MCPAN shell (setup if necessary) install HTML::CalendarMonthSimple Rob Reid, Jan. 4, 2007 }; my $year = 2007; my $header = q { TUNA Lunch Talks }; my $frontmatter = q {

Tuesday UVa / NRAO Astronomy (TUNA) Lunch Talks

A series of informal, brown-bag, lunchtime seminars for the discussion of current projects and astronomical news

Where, when and how

Location:

By default, the location is the second floor conference room (room 230), NRAO, Edgemont Road. Directions to NRAO are available on the information for speakers page.

Time:

Tuesdays 12:15 - 1:00 PM (unless otherwise noted)

How:

Further information for tuna speakers is available here.

Signing up

If you, or one of your visitors, would like to speak at TUNA, please send a message to

tunalunch at nrao period edu

The calendars below indicate currently open slots.

Although TUNA talks are traditionally on Tuesdays, other days of the week can be accomodated if enough advance time is given. Non-Tuesday TUNA talks (MUNA, WUNA, FUNA) are subject to room availability.

The schedule

Old schedules are available here.

}; my $endmatter = q {

Miscellaneous Info:

TUNA talks are now organized by Poonam Chandra, Antonio Hales, and Rob Reid. The email to use has changed to cut down on spam: tunalunch at nrao period edu. If you would like to consult old pages, they are available here.

}; if(@ARGV < 2 || $ARGV[0] !~ /^[01]?\d$/ || $ARGV[0] !~ /^[01]?\d$/){ print $usage; exit(1); } my $startmonth = $ARGV[0]; my $endmonth = $ARGV[1]; rename("index.html", "index.html.bkup") or die "could not rename index.html to index.html.bkup"; open(MAIN, "> index.html") or die "could not open index.html for writing"; print MAIN $header; print MAIN $frontmatter; for(my $month = $startmonth; $month <= $endmonth; ++$month) { print MAIN domonth($month, $year); } print MAIN $endmatter; close(MAIN) or die "error closing index.html"; sub domonth { my ($month, $year) = @_; my $cal = new HTML::CalendarMonthSimple('year' => $year, 'month' => $month); # $cal->width('90%'); # $cal->border(3); my $monthname = $cal->monthname(); $cal->header("$monthname $year"); $cal->tableclass("calendar"); $cal->weekdaycellclass("calendar"); $cal->weekendcellclass("weekendcal"); $cal->headerclass("mothhead"); my $datestart = sprintf("%s%02d", $year, $month); foreach my $txtfil (<$datestart*.tuna>) { open(CAN, $txtfil) or warn "could not read $txtfil"; my ($name, $url, $inst, $insturl, $title, @abslines) = do { local $/ = ""; }; close(CAN) or warn "error closing $txtfil"; my $abstract = join("\n\n", @abslines); foreach ($name, $url, $inst, $insturl, $title, $abstract){ s/\s+$//; } $url =~ s/-//; $insturl =~ s/-//; my $day = $txtfil; $day =~ s/^${datestart}0?(\d+)_.*/$1/; # Day number without any leading 0. tuna($cal, $day, $name, $url, $inst, $insturl, $title, $abstract); } return $cal->as_HTML; } sub tuna { my ($cal, $day, $name, $url, $inst, $insturl, $title, $abstract) = @_; my $lastname = $name; $lastname =~ s/.+ //; $lastname =~ s/ /_/g; my $year = $cal->year(); my $month = $cal->month(); my $monthname = $cal->monthname(); my $kindoffish = Date_to_Text($year, $month, $day); $kindoffish =~ s/(\w).*/$1UNA/; my $absheader = $header; $absheader =~ s/$kindoffish Lunch Talks/$monthname ${day}: $name/; $name = "$name" if($url); $inst = "$inst" if($insturl); my $absfile = sprintf("%s%02d%02d_%s.html", $year, $month, $day, $lastname); my $txtfile = $absfile; $txtfile =~ s/\.html/.tuna/; if (!-f $absfile || -M $absfile > -M $txtfile) { open(ABS, "> $absfile") or warn "could not > $absfile"; print ABS "$absheader"; print ABS "

$kindoffish Lunch Talk:

\n"; print ABS "

$name

\n"; print ABS "

$inst

\n"; print ABS "

$title

\n"; print ABS "

$monthname $day

\n"; print ABS "

12:00PM, Room 230, NRAO, Edgemont Road

\n"; print ABS "
Abstract:\n"; print ABS "

"; $abstract =~ s,\n\n,\n

\n

,g; print ABS "$abstract\n

\n
\n\n\n"; close(ABS) or warn "problem closing $absfile"; } $cal->setcontent($day, "$name, ${inst}: $title"); }