2 # (c) Petr Baudis <pasky@suse.cz>
13 # Ultra-trivial templating engine;
16 # /^@header produces HTML header based on @section and @heading
17 # /@@gitweburl@@/ substitute for gitweburl configuration variable
20 my $pathinfo = $ENV{PATH_INFO
};
23 my $gcgi = Girocco
::CGI
->new('HTML Templater');
24 print "<p>Hi, this is your friendly HTML templater speaking. Pass me template name.</p>\n";
28 unless ($pathinfo !~ m
#\./# and open(TEMPLATE, "$Girocco::Config::basedir/html/$pathinfo")) {
29 my $gcgi = Girocco
::CGI
->new('HTML Templater');
30 print "<p>Invalid template name.</p>\n";
34 if ($pathinfo =~ /\.png$/) {
35 print "Content-type: image/png\n\n";
36 print while (<TEMPLATE
>);
40 my ($gcgi, $section, $heading);
44 if (s/^\@section=//) {
47 } elsif (s/^\@heading=//) {
50 } elsif (s/^\@header//) {
51 $gcgi = Girocco
::CGI
->new($heading, $section);
54 s/@@(\w+?)@@/${$Girocco::Config::{$1}}/ge;
61 $gcgi and $gcgi->srcname("html/$pathinfo");