Commit Graph

539 Commits

Author SHA1 Message Date
nikic 8bdf02ad7d update include doc to use hashes and the current Environment API 2010-12-30 11:26:15 +01:00
Fabien Potencier dee2656c9d changed autoescape first argument from on/off to the standard true/false 2010-12-30 11:20:20 +01:00
Fabien Potencier 0177df4f7c added the possibility to have tags in the global scope (outside blocks) in a child template 2010-12-30 11:20:20 +01:00
Fabien Potencier 98edcd0cb6 replaced {% display foo %} with {{ block('foo') }} 2010-12-30 11:20:20 +01:00
Fabien Potencier a958ada7d3 replaced {% parent %} with {{ parent() }} 2010-12-30 11:20:20 +01:00
Fabien Potencier 6302705a1f removed 'joined by' support for the 'for' tag as a tag should not output something directly 2010-12-30 11:20:19 +01:00
Fabien Potencier c456666b0c added a note about autoescaping and concatenation in the doc 2010-12-30 11:20:19 +01:00
Fabien Potencier ac7803f9fc fixed scope for macros (macros can be imported in a block or outside of a block)
{% import "macros" as foo %}
    {% from "macros" import foo, bar as bar %}

    {% block foo %}
        {% import "macros" as foofoo %}
        {% from "macros" import foo as foofoo, bar as barbar %}

        {{ foo('something') }}
        {{ bar('something') }}

        {{ foofoo('something') }}
        {{ barbar('something') }}
    {% endblock %}
2010-12-30 09:51:57 +01:00
Fabien Potencier b0e766f256 fixed typo 2010-12-30 09:31:09 +01:00
Fabien Potencier 5c0d907e08 fixed CS 2010-12-30 09:31:09 +01:00
Arnaud Le Blanc 43ec3036f7 removed Template::callFunction 2010-12-30 09:31:09 +01:00
Arnaud Le Blanc 9528bac1e4 updated doc for functions 2010-12-30 09:31:08 +01:00
Arnaud Le Blanc 7794463706 Added sandbox support for functions 2010-12-30 09:31:08 +01:00
Arnaud Le Blanc 3615e9a386 Added auto-escaper support for functions
Functions' output is escaped by default and functions can declare
themselves "safe" using the "is_safe" option.
2010-12-30 09:31:08 +01:00
Arnaud Le Blanc c225a5bed9 Handle functions like filters
Functions are not global variables anymore. They are resolved at
compile time, and Twig_Function objects are instanciated only when
compiling.
2010-12-30 09:31:08 +01:00
Arnaud Le Blanc b247452ec5 Resolve imported functions at compile time
{% from %} is compiled as {% import %}, the imported module is placed in
a local variable, and calls to imported functions are compiled as calls
to module functions.
2010-12-30 09:31:08 +01:00
Arnaud Le Blanc ad6374434d Added nodes representing local variables
Allows to use local PHP variables as temporary variables in compiled
templates
2010-12-30 09:31:08 +01:00
Fabien Potencier d9e2c42e41 renamed Template::getParentBlock() and getBlock() to diplayParentBlock() and displayBlock(), which is semantically more correct 2010-12-30 09:31:08 +01:00
nikic 522f35ed6b update Core Extension doc 2010-12-23 12:31:14 +01:00
nikic 9dcf64e386 fix Exception documentation, remove use of Twig_SyntaxError 2010-12-23 12:31:10 +01:00
nikic 6d030c266a disallow {% set %}{% endset %} 2010-12-22 18:04:45 +01:00
nikic 4ebbc5e43e rename $parser to $stream in parseArguments 2010-12-22 18:04:34 +01:00
Fabien Potencier 8b74ea04ce added the possibility to look at more than just the very next token 2010-12-22 11:58:10 +01:00
Fabien Potencier d72b6ad136 readded TokenStream::look() 2010-12-22 11:51:29 +01:00
nikic 648c843523 TokenStream changes:
* remove unused look() and rewind()
 * do not shift tokens, but increase a pointer
2010-12-22 11:51:22 +01:00
nikic d1ae5dbf4c improve lexer (causes changes in token stream, token and parser) 2010-12-22 11:36:59 +01:00
Fabien Potencier 592834f7f6 fixed typo 2010-12-22 11:34:23 +01:00
nikic d88a3c805f remove $is_multitarget return in parseMultitargetExpression
Furthermore slightly reordered code thus removing redundant expect()
2010-12-20 19:06:42 +01:00
Fabien Potencier 1467586430 added some unit tests for previous commit 2010-12-20 19:05:45 +01:00
nikic ad8375ac4b One should only be able to assign to variables 2010-12-20 19:03:15 +01:00
nikic 06753220b9 remove unused $lineno variable 2010-12-20 19:01:33 +01:00
nikic f1583ce353 change while(1) to while(true) 2010-12-20 19:01:23 +01:00
nikic 59f45ba11d remove "(,)" hint from syntax error messages (the expect function will do that already) 2010-12-20 19:01:11 +01:00
nikic f14e0a37ca use the passed $token in isUnary and isBinary of ExpressionParser 2010-12-20 19:00:22 +01:00
nikic c0e1c49b2d Grammer/Hash: array -> hash 2010-12-20 18:01:48 +01:00
Fabien Potencier 6de8f8bd43 tweaked error message 2010-12-20 15:05:29 +01:00
Fabien Potencier 8e96487ada changed error messages to be more friendly 2010-12-20 14:48:07 +01:00
Fabien Potencier b1b173f167 converted the cycle filter to a function 2010-12-20 08:46:29 +01:00
Fabien Potencier 47a73476e0 converted the constant filter to a function 2010-12-20 08:43:27 +01:00
Fabien Potencier 8fe302bb3e converted the range filter to a function 2010-12-20 08:36:03 +01:00
Fabien Potencier 508a241179 forced functions to have fn_ as a prefix to avoid name clashes between functions and variables 2010-12-19 22:24:10 +01:00
Fabien Potencier 739bfb2891 fixed doc index 2010-12-19 21:53:00 +01:00
Fabien Potencier 3a6d9e8526 fixed typo 2010-12-19 21:52:54 +01:00
Fabien Potencier dc884c3888 rewrote the advanced chapter and documented globals and functions 2010-12-19 20:11:00 +01:00
Fabien Potencier afa47bd9a4 added global variables 2010-12-19 19:50:03 +01:00
Fabien Potencier 7fc5927721 made macro return their value instead of echoing directly 2010-12-19 19:50:03 +01:00
Fabien Potencier 9d77cf2254 added from tag 2010-12-19 19:50:00 +01:00
Fabien Potencier 1621435b89 added support for functions 2010-12-19 19:48:02 +01:00
Fabien Potencier 5c5e33ee12 fixed typo 2010-12-19 11:43:24 +01:00
Fabien Potencier c66cfa1d6e made macros callable when sandbox mode is enabled 2010-12-18 14:31:15 +01:00