Provided by: sreview-common_0.8.0-1_all bug

NAME

       SReview::Template - process a string or a file and apply changes to it

SYNOPSIS

         use SReview::Template;
         use SReview::Talk;

         my $talk = SReview::Talk->new(...);
         my $template = SReview::Template->new(talk => $talk, vars => { foo => "bar" }, regexvars => {"@FOO@" => "foo"});
         my $processed = $template->string("The @FOO@ is <%== $foo %>, and the talk is titled <%== $talk->title %>");
         # $processed now contains "The foo is bar, and the talk is titled ..."
         # (with the actual talk title there)
         $template->file("inputfile.txt", "outputfile.txt"

DESCRIPTION

       "SReview::Template" is a simple wrapper around Mojo::Template. All the variables that are
       passed in to the "vars" parameter are passed as named variables to Mojo::Template.

       In addition, some bits of SReview previously did some simple sed-like search-and-replace
       templating. For backwards compatibility, this module also supports such search-and-replace
       templating (e.g., SReview::Template::SVG has a few of those). These, however, are now
       deprecated; the $talk variable and Mojo::Template-style templates should be used instead.

ATTRIBUTES

       "SReview::Template" objects support the following attributes:

   talk
       An SReview::Talk object for the talk that this template is for.  Required. Will be passed
       on to the template as the $talk variable.

   vars
       Additional Mojo::Template variables to be made available to the template.

   regexvars
       Variables to be replaced by search-and-replace.

METHODS

   file
       A method to process an input file through the templating engine into an output file.

       Takes to arguments: the name of the input file, followed by the name of the output file.

       Is implemented in terms of the "string" method.

   string
       A function to process a string, passed as the only argument. Returns the result of the
       template function.