DTL-Fast version 1.00
=====================

This library is a perl templating system cloned from Django templating
language and extended after that.

Some ideas inspired by Java ways. 

This library is 90% compatible with Django templates. 

- There is no file caching yet
- There is not localization or internationalization yet

Differences from Django templates
=================================

  - Date and time formatting being done using Date::Format module, which 
    is uses C library routines strftime and ctime. Django uses it's own 
    placeholders.
    
  - `ssi` tag in Django uses absolute paths and ALLOWED_INCLUDE_ROOTS
    configuration option. This library works separately and may be used
    with different frameworks. So, `ssi` tag uses relative paths and 
    you MUST specify additional template constructor parameter: `ssi_dirs`
    which should be an array reference with list of dirs to search in.
    
  - `csrf_token` tag is not implemented, too well connected with Django.

  - `_dtl_*` variable names in context are reserved for internal system 
    purposes. Don't use them.
    
  - output from following tags: `cycle`, `firstof`, `firstofdefined` are being
    escaped by default (like in later versions of Django)
    
  - `escapejs` filter works other way. It's not translating every non-ASCII 
    character to the codepoint, but just escaping single and double quotes and
    \n \r \t \0. Utf-8 symbols are pretty valid for javascript/json.
    
  - `fix_ampersands` filter is not implemented, because it's marked as 
    depricated and will beremoved in Django 1.8

  - `pprint` filter is not implemented.

  - `iriencode` filter works like `urlencode` for the moment.

  - `urlize` filter takes well-formatted url and make a link with this url and
    text generated by unurlencoding and than escaping url link.
  
  - wherever filter in Django returns True/False values, DTL::Fast returns 1/0.

  - `url` tag works a different way. Because there is no framework around, we
    can't obtain model's path the same way. But you may pass `url_source` 
    parameter into template constructor or get_template/select_template 
    function. This parameter MUST be a reference to a function, that will 
    provide templating engine with url templates by some 'model path' (first
    parameter of url tag). Second parameter passed to the `url_source` handler
    will be a reference to array of argument values (in case of positional 
    arguments) or reference to a hash of arguments (in case of named ones). 
    Url source handler may just return a regexp template by model path and 
    templating engine will try to restore it with specified arguments. Or, you 
    may restore it yourself, alter replacement arguments or do whatever you 
    want. 
  
Django templating extensions
============================

  - `firstofdefined` - new tag, that works like `firstof` tag, but checks if 
    value is defined (not true)

    - `defined` logical operator. In logical constructions you may use `defined`
    operator, which works exactly like perl's defined

  - alternatively, in logical expresisons you may compare (==,!=) value to 
    `undef` or `None` which are synonims
    
  - `slice` filter works with ARRAYs and HASHes. Arrays slicing supports 
    Python's indexing rules and Perl's indexing rules (but Perl's one has no
    possibility to index from the end of the list). Hash slicing options should 
    be a comma-separated keys.
    
  - You may use brackets in logical expressions to override natural precedence
  
  - `forloop` context hash inside a `for` block tag contains additional fields:
    `odd`, `odd0`, `even` and `even0`
    
  - variables rendering: if any code reference encountered due variable 
    traversing, is being invoked with context argument. Like:
    
        {{ var1.key1.0.func.var2 }} 
        
    is being rendered like: 
    
        $context->{'var1'}->{'key1'}->[0]->func($context)->{'var2'}

  - you may use filters with static variables. Like:
  
        {{ "text > test"|safe }}

  - objects behaviour methods. You may extend your objects, stored in context 
    to make them work properly with some tags and operations:
    
    - and(operand)      - makes logical `and` between object and operand
    - or(operand)       - makes logical `or` between object and operand
    - div(operand)      - divides object by operand
    - equal(operand)    - checks if object is equal with operand
    - compare(operand)  - compares object with operand, returns -1, 0, 1 on 
                          less than, equal or greater than respectively
    - in(operand)       - checks if object is in operand
    - contains(operand) - checks if object contains operand
    - minus(operand)    - substitutes operand from object
    - plus(operand)     - adds operand to object
    - mod(operand)      - returns reminder from object division to operand
    - mul(operand)      - multiplicates object by operand
    - pow(operand)      - returns object powered by operand
    - not()             - returns object inversion
    - reverse()         - returns reversed object
    - as_array()        - returns array representation of object
    - as_hash()         - returns hash representation of object
        
INSTALLATION
============

To install this module type the following:

   perl Makefile.PL
   make
   make test
   make install

DEPENDENCIES
============

This module requires these other modules and libraries:

  Date::Format
  URI::Escape::XS

COPYRIGHT AND LICENCE
=====================

Copyright (C) 2014-2015 by Alexandr Evstigneev (hurricup@evstigneev.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
