#!/usr/bin/perl -ws
our ($tit,$ktit,$aut,$base,$h,$nocopy);
$tit ||= "";
$ktit ||= $tit ;
$aut ||= "No authors";
$base ||= "theslide";
mkdir($base) unless (-d $base);
open(CSS, "> $base/$base.css") or die("can't open $base.css\n");
print CSS << 'EOP';
hr { border: none; border-top: solid thin #f36e21; }
*.boxed { border: solid 1px #f36e21; margin: 6pt; padding: 6pt; }
*.orange { color: #f36e21; }
a { color: #d25c10; text-decoration: none; }
a:hover { color: #000; text-decoration: none; }
h1 { background-color: #f9ce87; font-size: large;
color: #000; padding: 3px; margin-bottom: 2px; }
h2 { background-color: #fbdea7; font-size: medium;
color: #000; padding: 3px; margin-bottom: 2px; }
h3 { background-color: #fbdea7; font-size: small;
color: #000; padding: 3px; margin-bottom: 2px; }
div.body { margin-left: 15px; margin-right: 15px; }
p { text-align: justify; }
/* for Boxml: */
table.box { border: solid 1px #000; margin: 1px; }
th.boxtitle { background-color: #548b8e;
color: #fff; border-bottom: solid 1px #000; }
*.tiny { font-size:small;}
pre { border: solid 1px #f36e21; margin: 3pt; padding: 3pt;}
EOP
close(CSS);
open(IDX, "> $base/$base-index.html") || die "can't open index.html: $!";
print IDX < );
print SLIDE qq(Forward to $slide[$cur]\n);
if ($cur > 2) {
$prev = $cur - 2;
print SLIDE qq( );
if ($cur > 2) {
$prev = $cur - 2;
print SLIDE qq(Back to $slide[$cur - 2]\n);
}
print SLIDE qq($tit
EOF
my $cur = 0;
$/ = "\n=";
while (<>) {
chomp;
last if (/^__END__/);
if (/css=(.*)/){ $css = $1; `cp $css $base/$base.css`; next; }
if (/tit=(.*)/) {
$tit = $1;
$ktit = $tit unless $ktit;
close IDX;
open(IDX, "> $base/$base-index.html") || die "can't open index.html: $!";
print IDX "
$tit
";
next;
}
if (/aut=(.*)/) { $aut = $1; next;}
if (/ktit=(.*)/){ $ktit = $1; next;}
s{\n>\s*(.*)}{
local $/; undef $/;
open(F,$1) or die "cant open $1";
$aux=
\n";
sub done {
unless ($nocopy) {
print SLIDE <\n$aux
\n";
}xge;
## s{I<(.*?)>}{save("$1")}gesx;
## s{C<(.*?)>}{save("$1")}gesx;
## s{B<(.*?)>}{save("$1")}gesx;
## s{G<(.*?)>}{save("")}gesx;
## s{L<(.*?)\|(.*?)>}{save("$2")}gesx;
if(s/^(!?)\s*(.*)//){
$title=$2;
$sec = $1;
}
###escapes();
$_=sp2html("$_");
$cur++;
$slide[$cur] = $title;
if($sec){
print IDX qq(
$title
\n);}
else { print IDX qq(
Back to $slide[$cur - 2]\n);
}
print SLIDE qq(
Up to index\n);
done();
}
open(SLIDE,">$base/$base$cur.html")
or die "can't open $base/$base$cur.html: $!";
my $next=$cur+1;
print SLIDE <$ktit: $title
\n";
$_=jjuudec($_);
print SLIDE $_;
if ($cur > 1) {
print SLIDE "
\n";
print SLIDE qq(
Up to index\n);
done();
}
}
print IDX "
\n/g; s/:\n(?=\s*\.\d)/\x01\n/gs; s/:\n(?=\s*\.)/\x02\n/gs; while(s/\x01([^\x01\x02#]+?\n\s*)#/
$verb{$1}<\/pre>\n/g;
}
return $pagina;
} else {
return "";
}
}
sub man2html{
my $name=shift;
my $t = `/usr/bin/man -w $name`;
chomp $t;
if($t =~ /\.gz$/){ $t = `/bin/zcat $t | /usr/bin/man2html`;}
else { $t = `/usr/bin/man2html $t`; }
## return "Erro $!-$@\n" if $! || $@;
$t =~ s!^.*?(NAME
.*)Index
.*!$1!si;
$t =~ s!H3>!H4>!ig;
$t =~ s!H2>!H3>!ig;
$t}
#import _only_ the get function
use LWP::Simple qw/get/;
sub url2html {
return get(shift);
}
__END__
=head1 NAME
mktalk - Perl script that generates HTML presentations
=head1 SYNOPSIS
mktalk [-aut='...'] [-tit='...'] [-base='...'] [-nocopy] present
=head1 DESCRIPTION
This script generates an index and a set of slides in HTML from a
presentation-file.
Unless the C<-base='...'> option is used, the default names of the
HTML files have a "theslide" preffix: thslide-index.html theslide1.html ...,
and will be placed under the "theslide" directory.
Slitelly inspirated in POD syntax.
=head1 Format of C files
=!Big title
Begins a new slide and makes a big title in the index page
=title
Begins a new slide and makes a title in the index
*item description
Makes a item in the current slide
indented paragraph
Makes a verbatim indented paragraph; good for code examples.
> file
Imports a file in verbatim mode
> comand |
Imports the output of a comand in verbatim mode
I<...>
C<...>
B<...>
Italic, Code and Bold (as in POD)
G
L
inserts a image or a link
=css=file.css
Inserts a link on every page to the css... normally, it should be on the
first line.
=tit=title
=ktit=title
=aut=author
To define a title and an author; you can also use the options to do the same
efect
=head1 An example
=ktit=Mktalk
=tit=mktalk - naife HTML slides generator
=aut=José João Almeida
=!Command line options
=!Syntax
*slides
*Items
*verbatins
*specials
*file include
*command output include
=slide definition
*to define a new slide
begin the line with a "="
=title
...
=Items
* to define items
* item1
* item2
...
=Verbatins
Para definir verbatins usar um parágrafo desencostado
Aqui vai um
paragrado desencostado
=Especiais
*italic I
I<...>
*bold B
B<...>
*code C
C<...>
*links L
L
*images
G
=file inclusion
*syntax
> file
*Exemplo
inclusion of this example
> example
=Inclusão de Comandos
*sintaxe
> comando |
*Exemplo
> date |
> date |
=head1 CHANGES
2001 01 10
- slides inside it's own directory
- =css=file command
=head1 TODO
- The example
- switch to make LaTeX slides
=head1 AUTHOR
J.Joao Almeida,
Based on an example of Tom Christiansen
=head1 SEE ALSO
perl(1).
=cut