=head1 NAME

Templer::Plugin::Dollar - A simple shell-like syntax for template variables.



This class implements a layout template filter plugin for C<templer> which
allows template variables to be included using a dollar sign followed by an
open brace, the variable name and a closing brace.

This allows template such as this to be used

=for example begin

        <title>${title escape="html"}</title>
        <meta name='author' content='${author} ${email escape=url}'/>

=for example end

Everything between the variable name and the closing brace is used B<as is> in
the transformation. The third line of the example is for instance transformed

=for example begin

        <title><tmpl_var name="title" escape="html"></title>

=for example end


=head1 LICENSE

This module is free software; you can redistribute it and/or modify it
under the terms of either:

a) the GNU General Public License as published by the Free Software
Foundation; either version 2, or (at your option) any later version,

b) the Perl "Artistic License".


=head1 AUTHOR

Bruno Beaufils <bruno@boulgour.com>



Copyright (C) 2015 Bruno Beaufils <bruno@boulgour.com>.

This library is free software. You can modify and or distribute it under
the same terms as Perl itself.


=head1 METHODS


use strict;
use warnings;

package Templer::Plugin::Dollar;

=head2 new

Constructor.  No arguments are supported/expected.


sub new
    my ( $proto, %supplied ) = (@_);
    my $class = ref($proto) || $proto;

    my $self = {};
    bless( $self, $class );
    return $self;

=head2 available

This plugin is always available.


sub available
    return 1;

=head2 filter

Filter the given template.


sub filter
    my ( $self, $str ) = (@_);

    $str =~ s/\$\{([^:\s}]+)([^}]*)\}/<tmpl_var name="$1"$2>/g;

    return $str;

  ->register_filter( "dollar", "Templer::Plugin::Dollar" );