]> mj.ucw.cz Git - temple.git/commitdiff
UCW::Temple::CGI: Added html_template().
authorMartin Mares <mj@ucw.cz>
Tue, 20 Jul 2010 12:14:18 +0000 (14:14 +0200)
committerMartin Mares <mj@ucw.cz>
Wed, 18 Aug 2010 15:35:12 +0000 (17:35 +0200)
UCW/Temple/CGI.pm

index 0dc71c5741556339c6c5857413ba82f425c50f9c..624f7e063254338c7a9d920cf69df301f5e37ae6 100644 (file)
@@ -8,11 +8,12 @@ use strict;
 use warnings;
 
 use UCW::Temple;
+use UCW::CGI;
 
 require Exporter;
 our $VERSION = 1.0;
 our @ISA = qw(Exporter);
-our @EXPORT = qw(out template shipout);
+our @EXPORT = qw(out template html_template shipout);
 our @EXPORT_OK = qw();
 
 our @out_buffer = ();
@@ -25,6 +26,12 @@ sub template($;$) {
        UCW::Temple::process_string($string, $args);
 }
 
+sub html_template($$) {
+       my ($string, $args) = @_;
+       my %hargs = map { $_ => html_escape($args->{$_}) } keys %$args;
+       UCW::Temple::process_string($string, \%hargs);
+}
+
 sub shipout() {
        print @out_buffer;
        @out_buffer = ();