Yehuda Katz
46c04fa71e
Make deep @data trigger the data option
2012-07-05 23:05:55 -07:00
Yehuda Katz
72e05d623c
Add support for @data variables
2012-07-05 22:43:05 -07:00
tomhuda
175c6fae0f
More cleanup
...
* Make block and inverse use the main helper path
* Eliminate separate inverse AST node
2012-05-28 17:00:41 -07:00
Yehuda Katz
8786a6c6e2
Start doing earlier work on helpers
2012-05-28 00:15:52 -07:00
Yehuda Katz
246325085f
Simple spec for isolation analysis
2012-05-26 22:17:31 -07:00
tomhuda
facefe8fed
Several improvements to compiled output:
...
* Eliminate legacy support for an options hash
that doubles as a function. This prevented us
from building the hash as a literal, and added
a bunch of code weight
* Create a new "stack literal" construct, that
allows an opcode to push a literal expression
onto the stack. This will not allocate a new
stack variable, and when popped, will simply
return the literal expression as a String.
2012-05-26 14:51:41 -07:00
Yehuda Katz
730c2617af
Differentiate between lambdas in the context (which should have mustache semantics) and helpers (which have Handlebars helper semantics).
2011-12-31 13:51:54 -08:00
Yehuda Katz
e474e56b80
data should be passed through to partials. closes #111 .
2011-12-27 15:57:08 -08:00
Yehuda Katz
69307d0e2b
Allow function parameters to #if. This was originally disallowed because it is decidedly not idiomatic Handlebars, which would prefer that you use helpers for these cases, not pollute your context objects with functions to call from your template, but enough people asked for it that I'll give in.
...
I will personally not be using this feature and still strongly recommend that people use helpers in this case.
2011-12-27 15:47:45 -08:00
Yehuda Katz
373d10edb1
Literal square-bracket path segments cannot have ] in them. TODO: Allow escaped path segments.
2011-12-27 01:21:53 -08:00
Yehuda Katz
bd0f74fbd9
Test that the hello world mustache example works
2011-12-27 00:43:30 -08:00
Yehuda Katz
e57e626480
Fix bug where inverse section was being passed to subsequent helpers
2011-12-27 00:30:46 -08:00
Peter Wagenet
43431d2a78
Added 'log' helper - See #97
2011-10-24 19:41:41 -07:00
Alan Johnson
6b18873d23
Fixed errors occurring because of undefined properties on nested paths.
2011-09-02 10:56:37 -04:00
Alan Johnson
c1c455acc8
Reproduced undefined property error.
2011-09-02 10:47:05 -04:00
Alan Johnson
f2f1f5f9bd
Wrote a quick test for partials with literal paths.
2011-09-02 10:36:59 -04:00
Alan Johnson
7212e2b7d7
Got more complex literal expressions working.
2011-09-02 09:10:20 -04:00
Alan Johnson
fc84308cc9
Got simple literal expressions added into paths.
2011-09-02 09:04:41 -04:00
kpdecker
f53737ef23
knownHandlers and knownHandlersOnly compile options.
2011-07-31 21:00:44 -05:00
kpdecker
993c793565
Avoid eval when running in VM+Compiler mode
2011-07-30 16:55:26 -05:00
kpdecker
3af9de7407
Update partial testing for the various modes
2011-07-30 16:12:20 -05:00
kpdecker
ccf32821df
Throw a handlebars exception when attempting to use template partials in VM mode.
2011-07-30 16:01:43 -05:00
kpdecker
8e23ce87d3
Use CompilerContext.compile for tests rather than Handlebars.compile.
...
This prevents false negatives on the partial tests.
2011-07-30 15:54:57 -05:00
kpdecker
3d9e5070f5
Move mismatched block test from quint to parser tests.
2011-07-30 15:25:25 -05:00
kpdecker
a927125909
Can access context variables masked by helpers by scoping with 'this.'
2011-07-29 20:53:47 -05:00
kpdecker
9062cac3f0
Add missing messages in equal tests
2011-07-29 20:45:17 -05:00
tomhuda
059a80661d
* Remove legacy support for inverse sections as additional parameters.
...
* Unify inverse and normal block helpers
* Make Handlebars.Exception inherit from JS Error
2011-07-07 23:09:33 -07:00
Alan Johnson
37e36bf137
Merge pull request #66 from rgrove/fix-empty-array-if
...
The "if" block helper shouldn't treat empty arrays as truthy
2011-06-27 03:15:50 -07:00
tomhuda
1482f1ae72
Add BOOLEAN support
2011-06-01 22:57:22 -07:00
tomhuda
0f78345d0c
Add support for INTEGER expressions
2011-06-01 22:33:48 -07:00
Ryan Grove
2f4644529c
Remove / from the list of escaped chars and add `.
...
It's probably fine not to escape /, since its only danger is in ending
entities (like &/). This isn't a problem for us, since the badChars
regex won't allow it and the & will get escaped.
It turns out ` can be used to quote attribute values in IE, so it needs
to be escaped along with " and '.
2011-05-09 15:19:23 -07:00
Ryan Grove
d109e31f62
Merge branch 'master' into fix-escaping
...
Conflicts:
lib/handlebars/utils.js
2011-05-09 14:59:51 -07:00
tomhuda
60040e60fb
Update specs and code so that the function passed to block helpers has the same API as regular compiled templates
2011-05-04 00:03:50 -07:00
tomhuda
c29223a98b
Update specs for change to template signature
2011-05-03 20:39:14 -07:00
tomhuda
9333d1210d
Add support for passing String parameters to helper
2011-05-03 19:30:32 -07:00
Yehuda Katz
3e5bc84058
Merge pull request #69 from rgrove/allow-hyphens.
...
Allow ids to contain hyphens. Fixes #36 .
2011-05-03 19:01:37 -07:00
Yehuda Katz
5d8480fa8a
Merge pull request #48 from jasondavies/master.
...
Fix multi-backslash escaping
2011-05-03 18:59:59 -07:00
Ryan Grove
b324d002ca
Allow ids to contain hyphens. Fixes #36 .
...
Previously, a mustache like {{foo-bar}} would generate a
parse error, which was a departure from the behavior of
other Mustache implementations.
2011-04-28 22:30:21 -07:00
Ryan Grove
b291a1ad8c
Add ", ', and / to the list of chars that need HTML escaping.
...
Previously, only < and > were escaped. This meant that any Handlebars
template that used user input in an HTML attribute value was wide open
to a trivial XSS exploit. Note that unquoted attribute values are still
open to attack, but this set of characters at least brings Handlebars in
line with other Mustache implementations and other template languages.
See the OWASP XSS prevention cheat sheet (rule #1 ) for the rationale
behind escaping these characters:
https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet
2011-04-25 11:15:53 -07:00
Ryan Grove
dec196b4d9
The "if" block helper shouldn't treat empty arrays as truthy.
...
Given the data {foo: []}, the following template previously considered
foo to be truthy when it shouldn't have:
{{#if foo}}
You should not see me!
{{else}}
You should see me!
{{/if}}
2011-04-20 16:56:37 -07:00
tomhuda
357710f136
Add support for block hashes and clean up mustache/program code
2011-03-04 15:10:22 -08:00
tomhuda
ca9b9671a5
Add Hash arguments to simple mustaches (TODO: add Hash args to block helpers)
2011-03-04 00:11:03 -08:00
Jason Davies
e5899cad1e
Test multi-backslash-escaping
2011-02-28 22:28:11 +00:00
Jason Davies
0397f875c5
Merge branch 'master' of http://github.com/wycats/handlebars.js
2011-02-28 22:23:11 +00:00
tomhuda
32d7e52182
Helpers take precedence over context properties with the same name. This is useful in scenarios where your context object is inherited from another system (such as a framework or JSON API) that may contain properties that conflict with helpers you explicitly define.
2011-02-25 23:01:11 -08:00
Jason Davies
0d4d8813ac
Merge branch 'master' of http://github.com/wycats/handlebars.js
...
Conflicts:
lib/handlebars.js
test/index.html
2011-02-21 01:51:31 +00:00
tomhuda
2b319bef2f
Make the function passed to a block helper have an identical signature to top-level template methods
2011-02-14 16:05:01 -08:00
tomhuda
299a0e81e3
data is passed to block helpers
2011-02-11 20:11:23 -08:00
tomhuda
88e7003331
* Added a few public API methods to JavaScriptCompiler.prototype, so it can be subclassed.
...
* made it possible to define an alternate name lookup scheme (so that {{foo}} does not have to be
context.foo, but can instead be something like context.get('foo'))
* made it possible to substitute an alternate buffer instead of the default empty String and override how
the compiled template appends to the buffer
* Added the concept of template-local data. In order to enable template-local data, pass true
as the second parameter to the template compiler. Then, pass in the data as the fourth
parameter (context, helpers, partials, data). These signatures may change before the 1.0 release.
2011-02-11 17:03:12 -08:00
Alan Johnson
ac4d34dbe3
Backed out function helpers.
2011-01-25 21:21:57 -05:00