[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[mgp-users 01158] Enhanced HTML slides
- To: mgp-users@mew.org
- Subject: [mgp-users 01158] Enhanced HTML slides
- From: Tony Finch <dot@dotat.at>
- Date: Tue, 27 May 2003 10:26:54 +0100
- Delivered-to: mailing list mgp-users@mew.org
- Mailing-list: contact mgp-users-help@mew.org; run by ezmlm
- Sender: Tony Finch <fanf@chiark.greenend.org.uk>
- User-agent: Mutt/1.3.28i
I use the comments in my Magicpoint source file as additional notes for
speaking from. I thought it would be a good idea to include the notes
in the HTML version of the slides. Here's a script:
#!/usr/bin/perl -w
#
# Add the notes from the talk to the HTML slides.
#
# $Cambridge: hermes/doc/talks/2003-05-techlinks/munghtml.pl,v 1.1 2003/05/26 11:56:35 fanf2 Exp $
use strict;
open TALK, "talk.mgp"
or die "open talk.mgp: $!\n";
sub getnotes {
my @notes;
my $line;
for (;;) {
$line = <TALK>;
last if not defined $line;
last if $line =~ m|^%page$|;
next unless $line =~ s|^#+\s*||;
chomp $line;
push @notes, $line;
}
return @notes;
}
# discard preliminary gubbins
getnotes;
my $i = 0;
for (;;) {
my @notes = getnotes;
last unless @notes;
my $mgp = sprintf "mgp%05d", ++$i;
if (not -f "$mgp.old") {
rename "$mgp.html", "$mgp.old"
or die "rename $mgp.html to $mgp.old: $!\n";
}
open OLD, "< $mgp.old"
or die "open $mgp.old: $!\n";
open NEW, "> $mgp.html"
or die "open $mgp.html: $!\n";
my $line;
for (;;) {
$line = <OLD>;
last if not defined $line;
if ($line =~ m|^\<IMG|) {
print NEW "<A HREF=\"$mgp.jpg\">\n";
print NEW "<IMG SRC=\"$mgp.jpg\" ALT=\"Page $i\" "
. "WIDTH=512 HEIGHT=384>\n";
print NEW "</A>\n";
print NEW map "<BR>$_\n", @notes;
} else {
print NEW $line;
}
}
close OLD or die "close $mgp.old: $!\n";
close NEW or die "close $mgp.html: $!\n";
}
close TALK or die "close talk.mgp: $!\n";
exit 0;
Tony.
--
f.a.n.finch <dot@dotat.at> http://dotat.at/
THE MULL OF GALLOWAY TO MULL OF KINTYRE INCLUDING THE FIRTH OF CLYDE AND THE
NORTH CHANNEL: SOUTHEAST 2 OR 3 VEERING SOUTHWEST 3 OR 4. OUTBREAKS OF RAIN OR
DRIZZLE AT TIMES. GOOD TO MODERATE. SLIGHT.