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
};
22 my $gcgi = Girocco
::CGI
->new('HTML Templater');
23 print "<p>Hi, this is your friendly HTML templater speaking. Pass me template name.</p>\n";
27 unless ($pathinfo !~ m
#\./# and open(TEMPLATE, "$Girocco::Config::basedir/html/$pathinfo")) {
28 my $gcgi = Girocco
::CGI
->new('HTML Templater');
29 print "<p>Invalid template name.</p>\n";
33 if ($pathinfo =~ /\.png$/) {
34 print "Content-type: image/png\n\n";
35 print while (<TEMPLATE
>);
39 my ($gcgi, $section, $heading);
43 if (s/^\@section=//) {
46 } elsif (s/^\@heading=//) {
49 } elsif (s/^\@header//) {
50 $gcgi = Girocco
::CGI
->new($heading, $section);
53 s/@@(\w+?)@@/${$Girocco::Config::{$1}}/ge;
60 $gcgi and $gcgi->srcname("html/$pathinfo");