#! /usr/local/bin/perl
# V a r i a b l e s -- begin --
# This section contains the default variables for processing.
#
# If you do not like the values, you should not simply overwrite them,
# but proceed as follows:
#
# 1) Choose a file name for your variables file:
# - either gl2html.conf in the current directory
# - or any file whose path you leave in the environment variable
# GL2HTML_CONF
#
# 2) Copy the entire "Variables" section into that file
#
# 3) Modify the variables
# Variables to determine operation
$html_markup = 0; # produce complete HTML file
$slide_markup = 0; # produce
s for S5 slide generation
# Variables that are always needed
$charset = 'ISO-8859-1'; # character set of input (cf. http://www.iana.org/assignments/character-sets)
# $charset = 'ISO-8859-15';
# $charset = 'UTF-8';
# $charset = 'windows-1252';
$language = 'de'; # language of document
# $language = 'en';
# Variables only used when both $html_markup and $slide_markup are set
$title = 'Title of presentation';
$pres_date = 'Date of presentation';
$firstname = 'Firstname';
$firstname_abbrev = 'F.';
$lastname = 'Lastname';
$name_title = '';
$author1 = "$firstname $lastname";
$author2 = "$firstname_abbrev $lastname";
if ($name_title) {
$author3 = "$name_title $author1";
} else {
$author3 = $author1;
};
$company1 = 'LRZ';
$company2 = 'Leibniz-Rechenzentrum';
# V a r i a b l e s -- end --
# find file with variables
$gl2html_conf = $ENV{'GL2HTML_CONF'};
if (!$gl2html_conf && -f "gl2html.conf") {
$gl2html_conf = "gl2html.conf";
};
if ($gl2html_conf) {
do $gl2html_conf;
};
# start
if ($html_markup) {
if ($slide_markup) {
print <$title
$title
$author3
$company2
END
} else {
print <Test
END
};
};
$depth = 0;
$marg = 0;
while (<>) {
chop;
next if /^\s*$/;
/^(\t*)([^\t])/;
$text = $2 . $';
$ndepth = length ($1);
&line_markup ($depth, $ndepth);
$depth = $ndepth;
if ($depth) {
print $text;
} else {
if ($slide_markup) {
print "\n\n\n
\n
$text
\n
";
$marg = 2;
} else {
print "\n\n\n
$text
\n";
};
};
};
&line_markup ($depth, 0);
if ($html_markup) {
if ($slide_markup) {
print "\n
\n\n\n\n";
} else {
print "\n\n\n";
};
};
sub line_markup {
($old, $new) = @_;
if (!$new) {
print "" x $old . "\n";
if ($marg) {
print "
\n
\n";
};
return;
};
if ($new > $old) {
print "\n" . ' ' x ($old + $marg) . "