Dotiac::DTL::Parser - The default Django/Dotiac parser
require Dotiac::DTL; $t=Dotiac::DTL->new("file.html") $t->print();
Creates a new empty Dotiac::DTL::Parser, used by Dotiac::DTL->new().
Parses the string referenced in TEMPLATEREF starting at the position referenced in POSITIONREF.
Returns the parsed templatedata if either one of the endtags is found (and sets FOUNDREF to the endtag) or the end of the string is reached.
This is used by tags to look for their endtag. For example the ifequal tag:
sub new { my $class=shift; my $self={p=>shift()}; #Text that came before the tag. my $data=shift; #Content of the tag other than the name. my $obj=shift; my $data=shift; #Templatedataref my $pos=shift; #and positionref from the parse() calling this tags new(). my $found=""; #Empty found $self->{true}=$obj->parse($data,$pos,\$found,"else","endifequal"); #Search for either "else" or "endifequal" and set it to $found. if ($found eq "else") { $self->{false}=$obj->parse($data,$pos,\$found,"endifequal"); #If "else" was found, search for "endifequal" } ($self->{var1},$self->{var2},undef)=Dotiac::DTL::get_variables($data); bless $self,$class; return $self; } #....
Dotiac::DTL::Reduced doesn't support this, so it doesn't have to load all the tags or the parser.
Returns the unparsed templatedata if either one of the endtags is found (and sets FOUNDREF to the endtag) or the end of the string is reached.
Skips STARTTAG occurences and searches for additional endtags
This is used by tags to look for their endtag. For example an unparsed tag:
sub new { my $class=shift; my $self={p=>shift()}; #Text that came before the tag. my $data=shift; #Content of the tag other than the name. my $obj=shift; my $data=shift; #Templatedataref my $pos=shift; #and positionref from the parse() calling this tags new(). my $found=""; #Empty found $self->{content}=$obj->unparsed($data,$pos,\$found,"unparsed","endunparsed"); bless $self,$class; return $self; } #....
There is no internal tag for now that needs this. But you might find some addons.
I planned this for a addon like Calypso DTL's {% ajax %} tag, that throws the unparsed template at DojoxDTL to render it in the browser.
Dotiac::DTL::Reduced doesn't support this either.
http://www.djangoproject.com, Dotiac::DTL
If you find a bug, please report it.
Dotiac::DTL was built according to http://docs.djangoproject.com/en/dev/ref/templates/builtins/.
Marc-Sebastian Lucksch
perl@marc-s.de
To install Dotiac::DTL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dotiac::DTL
CPAN shell
perl -MCPAN -e shell install Dotiac::DTL
For more information on module installation, please visit the detailed CPAN module installation guide.