kpdecker
5d4b8da344
Pass undefined fields to helpers in strict mode
...
This allows for `{{helper foo}}` to still operate under strict mode when `foo` is not defined on the context. This allows helpers to perform whatever existence checks they please so patterns like `{{#if foo}}{{foo}}{{/if}}` can be used to protect against missing values.
Fixes #1063
2015-08-03 15:59:53 -05:00
kpdecker
9f265b9761
Handle this references properly in track id mode
2015-08-03 12:13:24 -05:00
kpdecker
efddc3c09c
Increase code coverage
2015-08-01 22:01:16 -05:00
kpdecker
4bed826d0e
Update for let and optional parameters
2015-04-20 02:38:28 -05:00
kpdecker
e3d3eda2e1
Add full support for es6
...
Converts the tool chain to use babel, eslint, and webpack vs. the previous proprietary solutions.
Additionally begins enforcing additional linting concerns as well as updates the code to reflect these rules.
Fixes #855
Fixes #993
2015-04-16 16:43:01 -05:00
kpdecker
2d149e7797
Add undefined and null literal support
...
This adds the UndefinedLiteral and NullLiteral to AST.
Fixes #990
2015-04-07 23:37:38 -05:00
kpdecker
c15f90e513
Fix typo
2015-02-10 20:40:53 -06:00
kpdecker
39121cf8f5
Handle all potential literal values
...
Adds support for literal helper names in a few missing cases such as block expressions and subexpressions.
2015-02-09 23:54:46 -06:00
Marcio Junior
07f27843dc
Transform literals to path expressions in mustache nodes
2015-02-08 19:31:38 -02:00
Marcio Junior
5cc326d425
Test compilation of literal values in mustaches
2015-02-08 19:31:38 -02:00
kpdecker
884bf15536
Avoid direct references to sexpr in statements
...
This allows us to avoid creating unnecessary AST nodes and avoids things like isHelper.
Side effect of these changes is that @data functions can now have data parameters passed to them.
2015-01-18 17:27:27 -06:00
kpdecker
cb51b82b8e
Add support for dynamic partial names
...
Uses the subexpression syntax to allow for dynamic partial lookups. Ex:
```
{{> (helper) }}
```
Fixes #933
2015-01-18 13:23:45 -06:00
kpdecker
0a9fc171b0
Fix block param evaluation under older IE
2014-12-27 13:13:52 -06:00
kpdecker
396795c983
Implement block parameters
...
Fixes #907
2014-12-26 00:31:57 -06:00
kpdecker
9e907e6785
Expose AST helpers in public API
2014-12-21 22:32:50 -06:00
kpdecker
69b1bdd32e
Avoid unnecessary this. reference
2014-12-16 12:57:46 -06:00
kpdecker
c05fad8b18
Fix remaining depth arg
2014-12-16 12:57:46 -06:00
kpdecker
203df9d5b7
Remove unused vars and add jshint checking
2014-12-16 12:57:46 -06:00
kpdecker
0d396ccd30
Remove Compiler.depths parameter
...
This is no longer necessary with the depths array tracking and adds compiler overhead.
2014-12-16 12:57:46 -06:00
kpdecker
b6ba2dcdb0
Move compileProgram out of visitor methods
2014-11-29 18:02:58 -06:00
kpdecker
5b0efc7e91
Track source node via accept call rather vs opcode
2014-11-29 18:02:58 -06:00
kpdecker
a655aedb5c
s/Subexpression/SubExpression/
2014-11-29 17:59:09 -06:00
kpdecker
f990cf0064
Treat partial exec in a manner closer to helpers
...
This helps unify the code handling and will also be needed to support string/id tracking on partials.
2014-11-27 09:11:03 -06:00
kpdecker
1124908d2a
Update subexpression and hash AST constructs
2014-11-27 08:37:48 -06:00
kpdecker
e1cba432a6
Simplify Path and Sexpr calculated flags
2014-11-27 07:32:15 -06:00
kpdecker
5c921cafeb
Replace DataNode and IdNode with PathNode
...
This is a breaking change for string mode users as there is no longer a distinct type for data parameters. Instead data consumers should look for the @ prefix value.
2014-11-26 20:36:36 -06:00
kpdecker
697bbe59ca
Update literal ast nodes for new spec
2014-11-26 19:22:09 -06:00
kpdecker
2a4819d75c
Update statement node ASTs
2014-11-26 19:04:18 -06:00
kpdecker
5cfe6a0be1
Update MustacheNode for new AST structure
2014-11-26 09:31:46 -06:00
kpdecker
df421f1e4b
Update ProgramNode to better match SpiderMonkey
2014-11-26 09:18:33 -06:00
kpdecker
61dd721ca2
Update AST location info to match SpiderMonkey
...
Part of #889
2014-11-26 09:01:03 -06:00
kpdecker
bf8cc50798
Merge branch 'remove-block-mustache' of github.com:mmun/handlebars.js into mmun-remove-block-mustache
...
Conflicts:
lib/handlebars/compiler/helpers.js
spec/parser.js
2014-11-08 18:57:06 -06:00
kpdecker
249f559104
Include location information in all opcodes
2014-11-08 17:50:01 -06:00
Martin Muñoz
12e3d210e8
Simplify BlockNode by removing intermediate MustacheNode
2014-11-02 18:19:20 -05:00
kpdecker
632fadcea3
Add preventIndent option for partials
...
This disables the standalone partial indent behavior required by the Mustache spec and allows for users to utilize partials in the same manner as under 1.x.
Fixes #858
2014-11-02 12:19:56 -06:00
kpdecker
ca1486b960
Prune unused code
2014-08-25 22:39:17 -05:00
kpdecker
501a640330
Allow passing depths to _child
2014-08-25 00:32:57 -05:00
kpdecker
477a26913a
Optimize compiler opcode call
2014-08-24 18:16:11 -05:00
kpdecker
84d646bb5d
Move strip processing into AST helper logic
...
We already have to track these behaviors for the standalone parsing and rather than having two whitespace pruning implementations this moves all of the behavior into one place.
Fixes #852
2014-08-23 17:44:20 -05:00
kpdecker
ccd803ff15
Replace string value rather than add omit flag
2014-08-23 16:37:30 -05:00
kpdecker
9e3f824bf5
Fix compiler program de-duping
2014-08-14 12:27:39 -05:00
kpdecker
b94656a31f
Drop unused Compiler.disassemble method
2014-08-14 12:27:23 -05:00
kpdecker
3cea85b2b0
Drop unused DECLARE opcode
2014-08-14 12:27:02 -05:00
kpdecker
c98613b711
Implement recursive field lookup in compat mode
...
Provides the mustache behavior of recursive lookup without the use of depthed paths.
Note that this does incur a fairly dramatic performance penalty for depthed queries.
2014-08-13 20:46:42 -05:00
kpdecker
f6dc5ad716
Create contextName helper for context lookup
2014-08-13 11:41:27 -05:00
kpdecker
e93d516672
Render indent for standalone partials
2014-08-12 14:41:58 -05:00
kpdecker
2a47d66ee9
Drop omitted content tags from generated output
2014-08-12 14:41:58 -05:00
kpdecker
271106d43f
Do not lookup pathed helpers on the helper stack
...
Fixes #764
2014-07-12 12:50:54 -05:00
kpdecker
c90cfe247c
Use ID lookup for ambiguous helper evaluation
...
Final change for #731
2014-07-07 00:20:02 -05:00
kpdecker
b5a5c76ceb
Rework lookup null protector logic
...
- Move the lookup null protection out of `nameLookup` and into that contexts that are aware of the needs for falsy vs. not displayed values.
- Optimize lookup for nested path operations
Fixes #731
2014-07-06 23:41:15 -05:00