Commit Graph

178 Commits

Author SHA1 Message Date
fzerorubigd
cc5bb9bf87 Merge branch 'patch-4' of github.com:ulriklystbaek/handlebars.php 2014-08-29 11:09:59 +04:30
fzerorubigd
77e71e6543 Merge branch 'patch-3' of github.com:ulriklystbaek/handlebars.php 2014-08-29 11:08:49 +04:30
ulriklystbaek
122a8a9d7b Update Context.php
Should return null instead of an empty string when context is not found. Handlebars.js returns undefined, which makes it possible to distict an empty string and not existing. (should not affect existing use, because null is handeled the same way as empty string)
2014-08-28 10:10:05 +02:00
ulriklystbaek
abb88322e0 Update UnlessHelper.php
To comply with handlebars.js, If adds an extra layer when need to access parents (https://github.com/wycats/handlebars.js/issues/196)
2014-08-28 09:50:53 +02:00
ulriklystbaek
415a3b00b8 Update IfHelper.php
To comply with handlebars.js, If adds an extra layer when need to access parents (https://github.com/wycats/handlebars.js/issues/196)
2014-08-28 09:49:32 +02:00
Behrooz Shabani
c6f3e0fd5e Merge pull request #75 from Mibew/named_arguments
Add named arguments parser
2014-08-20 23:15:37 +04:30
behrooz shabani (everplays)
07c49bbb3f make sure that buffer is always a string 2014-08-20 13:08:33 +04:30
behrooz shabani (everplays)
35ea671fd7 fix 0 being treated as empty string, fixes #76 2014-08-20 10:14:02 +04:30
Dmitriy Simushev
92a3815d85 Add named arguments parser 2014-08-19 11:21:20 +00:00
fzerorubigd
84c6e3006c
fix #71 2014-07-11 21:05:26 +04:30
fzerorubigd
a9178d5f01
fix phpcs 2014-07-04 22:30:41 +04:30
fzerorubigd
0a35a913c2
add more test and fix a wrong test, also comment some not-used-at-all codes.
If need some of thease code back, create a test case for them.
2014-07-04 22:22:18 +04:30
fzerorubigd
a68318f4c5
Support whitespace deletion
Need more test :)
fixes #61
2014-07-04 03:36:14 +04:30
John Slegers
182bfc9aea Patch 2 for arrays that contain only one elements
For arrays that contain only one element, `(array_keys($tmp) == range(0, count($tmp) - 1)` always returns true.

`(array_keys($tmp) === range(0, count($tmp) - 1)` works as expected.

My local test environment = Linux Mint + PHP 5.4.

This patch is identical to https://github.com/XaminProject/handlebars.php/pull/66, but applies to a different part of the code.
2014-07-03 16:53:22 +02:00
John Slegers
9d0bb58d36 Adding author data
Adding author data
2014-07-02 19:08:39 +02:00
John Slegers
c28709eb76 Update EachHelper.php
For arrays that contain only one element, `(array_keys($tmp) == range(0, count($tmp) - 1)` always returns true.

`(array_keys($tmp) === range(0, count($tmp) - 1)` works as expected.
2014-07-02 18:59:58 +02:00
Dmitriy Simushev
a6955b83a9 Fix quotes extra escape 2014-06-24 14:42:22 +00:00
behrooz shabani (everplays)
93b6dd8cb6 fixes extra escaping of scalar arguments 2014-06-23 13:29:50 +04:30
behrooz shabani (everplays)
81f3efbb84 helpers with style of array(Object, methodName)
Previously we had them working. So for the sake's of backward
compatibility, they should be supported.
2014-03-27 12:03:35 +04:30
Jeff Turcotte
c166af1ed7 Added helper interface and converted all built in helpers 2014-03-26 21:59:57 -04:00
behrooz shabani (everplays)
4e0ed3c7ae more escaping related fixes 2014-03-21 03:29:31 +03:30
behrooz shabani (everplays)
d719bd12ca don't eat up backslashes. fixes #59 2014-03-21 02:39:59 +03:30
behrooz shabani (everplays)
97201fe861 local merge of #56 PR. fixes 54 2014-03-20 22:55:05 +03:30
majortom731
ffcbecf346 Implemented proper treatment of brackets inside string arguments in subexpressions ( {{foo '(bar)'}} ) 2014-03-17 23:01:30 +01:00
majortom731
30f7afeb84 More code style / indentation fixes 2014-03-17 16:46:12 +01:00
majortom731
5257701669 Fixed indentation / code style 2014-03-17 16:41:54 +01:00
behrooz shabani (everplays)
7f6dcf6c3e final touch on fixing missing copyright notices 2014-03-17 13:44:21 +03:30
behrooz shabani (everplays)
413585f9ce Added missing copyright notices. fixes #57 2014-03-17 00:58:50 +03:30
majortom731
41722af86d Added testHelperSubexpressions() 2014-03-12 19:39:05 +01:00
majortom731
3fc92fcdc5 Added support for subexpressions in helper calls. Not sure if Template.php is the best place to handle subexpressions... 2014-03-12 19:33:46 +01:00
majortom731
5c3ea257b7 Changed the internal 'if' helper such that it can test not only paths/variable names, but also numeric constants.
This will be helpful for subexpressions later, when testing numeric subexpressions return values,

eg: {{#if (eq 0 (mod @index 3))}}

Also added a test for this.
2014-03-12 17:00:09 +01:00
behrooz shabani (everplays)
da443c5fd5 added support for escaping tags. fixes #53 2014-03-08 14:50:08 +03:30
fzerorubigd
9c91ea7d64
add another test 2014-02-26 21:13:11 +03:30
fzerorubigd
939c58bbee
Some test improvement and add an ArrayLoader 2014-02-26 20:26:51 +03:30
Dmitriy Simushev
39dd482df5 Add "@first" and "@last" values to "each" helper 2014-02-25 13:24:41 +00:00
Dmitriy Simushev
9d62ffd581 Use both "@index" and "@key" for associative arrays 2014-02-25 12:40:47 +00:00
Dmitriy Simushev
b4c019372b Add segment-literal notation for expressions 2014-02-05 09:07:02 +00:00
Dmitriy Simushev
79373a193a Add \Handlebars\SafeString class 2014-02-03 08:50:01 +00:00
Dmitriy Simushev
b6a903fee8 Use handlebars escape function for helpers' results 2014-02-01 10:44:23 +00:00
behrooz shabani (everplays)
3a3ab36c5f escape helpers. fixes #42 2014-02-01 11:29:52 +03:30
Dmitriy Simushev
f82c3a8098 Reset stop token after iterations in each helper 2014-01-28 15:11:17 +00:00
Behrooz Shabani
8c686a924a Merge pull request #40 from Mibew/each_else
Add "else" block to "each" helper
2014-01-23 08:07:48 -08:00
Dmitriy Simushev
93884fb26b Add "else" block to "each" helper 2014-01-23 11:44:34 +00:00
Dmitriy Simushev
c5d6a482c1 Add "else" block to "unless" helper 2014-01-23 09:59:13 +00:00
ulriklystbaek
7894899aba Update Context.php
Added author
2014-01-21 09:42:48 +01:00
ulriklystbaek
4e2c869d3b Update Context.php
If the array contains the given key with a null value, the null value should be returned instead of an empty string.
2014-01-21 09:23:54 +01:00
Chris Gray
4d5e433e61 Fixed formating. 2014-01-20 11:14:53 -06:00
Chris Gray
a44777f52f Added Tests and changed internal representation of quoted string literals from strangely quoted string to an instance of \Handlebars\String 2014-01-20 09:57:16 -06:00
Chris Gray
49dcbb2573 Changed Internal representation of quoted string literals to be an instance of \Handlebars\String instead of strangely quoted string. 2014-01-20 09:04:31 -06:00
Chris Gray
3603a00ee6 Added support for .length as an alias to count on the current context in Context::_findVariableInContext 2014-01-19 21:07:03 -06:00
Chris Gray
1bbe32b56e Updated docblock 2014-01-19 21:06:22 -06:00
Chris Gray
415e642351 Fixed to conform to coding standards 2014-01-17 00:46:39 -06:00
Chris Gray
78974dee1b Fixed edge case in Context::get where trim was eating trailing escaped quote in a quoted literal string that ends with an escaped quote 2014-01-17 00:30:14 -06:00
Chris Gray
da1cf77c58 Added string literal support in Context::get and added Template::parseArguments to ease plugin development 2014-01-16 23:28:48 -06:00
cgray
1119784549 Update Context::get to resolve @key and @index 2014-01-16 12:41:02 -06:00
Craig Bass
689c9e51de Allow each helper to accept PHP Generators 2014-01-16 13:29:10 +00:00
behrooz shabani (everplays)
94fbc01217 first part is going to be used, so ignore the rest 2013-12-13 23:09:06 +03:30
behrooz shabani (everplays)
df6ecac7df extracted processing of sections from variable processing 2013-12-13 23:04:31 +03:30
behrooz shabani (everplays)
300f44e8c6 fixed a typo 2013-12-13 22:29:54 +03:30
fzerorubigd
ff503a90a2
add more test 2013-12-06 21:32:36 +03:30
fzerorubigd
fa65e99dfe
fix a bug in context when get invalid variable in strict mode 2013-12-06 20:43:51 +03:30
fzerorubigd
f2a30c6ef1
More test for better coverage 2013-12-06 19:17:27 +03:30
fzerorubigd
82ea9f958d
add support for inline helper without #
fix #28
2013-12-06 18:00:03 +03:30
fzerorubigd
000bdd6e74
change default helpers to anonymus function again 2013-11-21 23:41:20 +03:30
behrooz shabani (everplays)
a4e56e3f60 allow accessing stuff via 0 index, fixes #30 2013-11-19 18:18:32 +03:30
Craig Bass
df1d4fb98d Fix crybaby tavis.
(Seriously?)
2013-11-15 01:25:02 +00:00
Craig Bass
4bbb9e3a6b update authorship 2013-11-15 01:00:49 +00:00
Craig Bass
3ee0e13caf Fix bug using array $baseDir
* Corrected issue resulting from array constructor
* Corrected issue resulting from invalid clean-up of references
2013-11-14 18:07:42 +00:00
fzerorubigd
25190010e1
fix a bug with helpers and add a test for that 2013-11-08 19:00:54 +03:30
fzerorubigd
8938fdc5c3
Another cleanup 2013-11-08 18:48:19 +03:30
fzerorubigd
287a8da70c
fix indent of switch 2013-11-08 16:24:11 +03:30
fzerorubigd
d1856a4ed3
Cleanup. 2013-11-08 15:00:49 +03:30
behrooz shabani (everplays)
ef5cd2cb25 replaced require with include as phpcs complained 2013-11-08 00:09:47 +03:30
behrooz shabani (everplays)
17ed55111b made autoloader compatible with namespaces 2013-11-05 15:37:20 +03:30
behrooz shabani (everplays)
926b4fdc4d no longer Handlerbars_ prefix is being used 2013-11-05 15:36:34 +03:30
behrooz shabani (everplays)
79f25a884d fixed a typo in class names 2013-11-05 15:33:48 +03:30
behrooz shabani (everplays)
e513648544 use PHP CodeSniffer's coding standards 2013-11-05 14:12:44 +03:30
behrooz shabani (everplays)
8ed1ebd051 Merge branch 'master' of github.com:virtuecenter/handlebars.php
Conflicts:
	src/Handlebars/Template.php
2013-11-05 10:58:02 +03:30
Bouke Versteegh
eda8d34cbb Added support for @index in #each-helper when used on lists. 2013-11-01 18:27:13 +01:00
Bouke Versteegh
c441a93a9f Merge github.com:boukeversteegh/handlebars.php 2013-11-01 14:05:19 +01:00
Bouke Versteegh
3d5d44d6d7 Added support for @index in sections: {{#listsection}}, and @key in objects: {{#each object}} 2013-11-01 13:57:00 +01:00
Alex Soncodi
a7a01ed2ff Do not ignore I/O errors. 2013-10-29 14:52:13 -05:00
Alex Soncodi
1b65a63b0c Create cache dir if it does not exist. 2013-10-29 00:13:58 -05:00
Alex Soncodi
72d4a9cd3e Add disk cache. 2013-10-28 23:38:50 -05:00
Dan Fellars
c179a4ce9b Converted License from GPLv3 to MIT 2013-10-18 10:07:27 -06:00
webuser
95c5821097 add factory 2013-09-22 09:56:44 -04:00
webuser
9319f3d89c missed a few namespace issues 2013-09-21 15:41:17 -04:00
webuser
82a9faf3eb add namespace, remove underscores from class names 2013-09-21 15:10:30 -04:00
Diosney
6ea602c9c9 Helpers: Added PHP 5.2 support. 2013-08-21 10:23:15 -04:00
Behrooz Shabani
8eb732f407 Merge pull request #15 from daviddeutsch/master
Support for context passed into a partial as an argument
2013-07-26 03:17:19 -07:00
David Deutsch
3229ad7c45 Support for context passed into a partial as an argument 2013-07-26 01:27:07 +02:00
fzerorubigd
ed925cf1b8
add registerPartial to fix #10 2013-06-01 17:55:42 +04:30
fzerorubigd
65eb09d101 Adding Handlebars_String to fix #12
If a helper return a Handlebars_String, then the result is compiled again.
2013-06-01 17:40:45 +04:30
David Deutsch
0451fa2483 Support recursive object traversal
Nested this.property traversal wasn't possible. With this fix, it is.
2013-04-02 13:12:27 +03:00
fzerorubigd
e6b4182a75
another fix :I 2013-03-18 23:55:37 +03:30
fzerorubigd
ecbfa8f383
fix #9
Damn, I should write tests!
2013-03-18 15:12:40 +03:30
fzerorubigd
89f0c00790
Add array of path support to file system loader.
fix #9
2013-03-16 10:53:16 +03:30
Fzerorubigd
65fe447c36 Merge pull request #8 from meraki/upstream
Add APC cache
2013-02-27 12:22:54 -08:00
fzerorubigd
c550491841
Add cache->set method to engine
Signed-off-by: fzerorubigd <fzerorubigd@gmail.com>
2013-02-27 23:49:33 +03:30
Joey Baker
09c0442132 Setting a prefix on partial now works with sub directories 2013-02-26 17:44:13 -08:00