Marc - Sebastian Lucksch > Dotiac-0.8_1 > Dotiac::DTL::Variable

Download:
dotiac/Dotiac-0.8_1.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.8   Source  

NAME ^

Dotiac::DTL::Variable - Stores a Django template variable tag.

SYNOPSIS ^

Template file:

        Some text.... 
        {{ variable }}
        Some other Text. {{ variable|lower }} Some more text.
        Even more Text.{{ "Quoted text"|lower }} End of Text.

Perl file:

        use Dotiac::DTL;
        my $template=Dotiac::DTL->new("template.file");
        $template->print({variable=>"Dynamic Text"});

DESCRIPTION ^

Everything between the starting {{ and the next }} is treated a variable name. Stuff that doesn't belong to the first variable is silently ignored:

        {{ variable variable2 }} is the same as {{ variable }}

{{ variable|lower }} is a varible with a filter, see Dotiac::DTL::Filter for more details on filters. Everywhere a variable is requested you can also use a string and/or filters as these are considered to be part of the variable. Here shown with the tag cycle (Dotiac::DTL::Tag::cycle):

        {% cycle variable othervariable, "string with spaces, and even colons" %}
        {% cycle variablewithfilter|lower variablewithmorefilters|lower|addslashes %}
        {% cycle "string with a filter"|lower|addslashes "string with a filter with arguments"|cut:", " %}

The variable can not contain spaces, colons or other special chars, unless those are in quotes (single or double) They can never contain (for now) : %} and }}, depending on wether they are in a tag or standalone.

The module itself has no real use, it's just used by the Dotiac::DTL parser to store free standing variables. Variables in specific tags are stored in those.

BUGS ^

If you find a bug, please report it.

SEE ALSO ^

http://www.djangoproject.com, Dotiac::DTL

LEGAL ^

Dotiac::DTL was built according to http://docs.djangoproject.com/en/dev/ref/templates/builtins/.

AUTHOR ^

Marc-Sebastian Lucksch

perl@marc-s.de

syntax highlighting: