#!/usr/bin/perl

use warnings;
use strict;

use MyTemplate;

my (@slide, $titel);

while(<>) {
	s/\[([^\]]+)\]/<a href="$1">$1<\/a>/g;

	unless($titel) {
		$titel = $_;
	} elsif(/^\t(.*)$/) {
		$slide[$#slide]->{slide_body} .= $1;
	} elsif(/^(.*):$/) {
		push @slide, { slide_titel => $1, slide_body => "", slide_num => scalar @slide, slide_next => $#slide + 2 };
	}
}

print MyTemplate->new($0, "TMPL")->substitute(
	titel  => $titel,
	slides => \@slide,
)->print;

__END__
__TMPL__
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
<head>
<title>[titel]</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="Ingo Blechschmidt &lt;iblech@web.de&gt;" />
<link rel="stylesheet" href="style.css" />
</head>
<body>

<!--
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

Ingo Blechschmidt
Arberstraße 5
86179 Augsburg
E-Mail: iblech@web.de, http://linide.sf.net/, http://klasse10.tk/
Tel.: +49 821 882955
-->

<a style="font-size: 200%; text-align: center;" href="#slide_0">(...)</a>

[slides]
	<a href="slide_[slide_next]">&nbsp;</a>
	<h1 id="slide_[slide_num]">[slide_titel]</h1>
	<div class="body">
		[slide_body]
	</div>
[/slides]

</body>
</html>
