Commit Graph

388 Commits

Author SHA1 Message Date
kpdecker a5ff1f3d22 vv2.0.0-alpha.1 2014-02-10 02:11:07 -06:00
kpdecker 6da3c31494 Update compiler revision info 2014-02-10 01:50:32 -06:00
kpdecker c72a8d5e84 Add child accessor API 2014-02-09 22:48:38 -06:00
kpdecker 16f135835e Add support for depthed resolution of data fields 2014-02-09 18:35:22 -06:00
kpdecker 306feb497c Implement lookup helper 2014-02-09 17:22:18 -06:00
kpdecker 14b7ef9066 Make raw blocks operate like blocks 2014-02-09 15:11:12 -06:00
Jesse Ezell 9b14dc40a5 raw block helpers 2014-02-09 14:41:32 -06:00
kpdecker 7a7ad74ff1 Optimize buffer generate first and all edge cases 2014-02-09 14:24:18 -06:00
Kevin Decker bc8f6792e8 Merge pull request #729 from wycats/precompile-literal
Convert template spec to object literal
2014-02-08 20:01:52 -06:00
kpdecker 2812fe2775 Convert template spec to object literal
This allows for metadata to be associated with the template and a simplification of the template init logic.
2014-02-06 23:05:45 -08:00
kpdecker b0e7298523 Remove unnecessary conditional 2014-02-06 23:01:43 -08:00
kpdecker cea57c05e2 Optimize initData for root defined case 2014-01-18 09:23:11 -06:00
kpdecker 311be67bde Add partial and helper unregister APIs
Fixes #669
2014-01-18 09:22:29 -06:00
kpdecker 5a0bcb932d Fix handler execution in nondata/nonid mode 2014-01-17 23:24:35 -06:00
kpdecker 49fcf10de2 Add contextPath tracking in builtin helpers 2014-01-17 23:15:18 -06:00
kpdecker ace2896ec8 Add trackIds compiler flag
Allows helpers that care about where a particular field came from derive this data while maintaining backward compatibility with existing helpers.
2014-01-17 23:15:17 -06:00
kpdecker 33921beaa0 Fix missing parameters for pathed mustaches
Fixes #658
2014-01-17 23:09:59 -06:00
kpdecker d4cfe90959 Allow decimal number values
Fixes #472
2014-01-17 20:42:02 -06:00
kpdecker fe4880feaa Allow implicit context iteration with each
Fixes #671
2014-01-17 20:13:00 -06:00
kpdecker 45ae86a248 Implement partial hash evaluation 2014-01-17 17:51:52 -06:00
kpdecker f90981adf6 Add partial hash parser support 2014-01-17 17:51:52 -06:00
Blake Embrey 13633e7896 Improve usefulness of extend util, properly use namespace property, update setup options to use a hash helper. 2014-01-16 21:24:26 +10:00
Kevin Decker 5659db4877 Merge pull request #634 from wycats/name-option
It would be great to have the helper name passed to `blockHelperMissing`
2014-01-15 08:42:32 -08:00
kpdecker f650b0d69e Expose the initial context via @root 2014-01-15 09:41:53 -06:00
kpdecker d385e2cab6 Cleanup now unused code in jscompiler 2014-01-06 16:07:56 -06:00
kpdecker 0f328f375e Include name option for all helper calls
All helper calls will have access to `options.name` which is the first id value of the mustache operation.

As part of this the helperMissing call has been simplified to remove the indexed name in order to optimize the call. This is a breaking change.

Fixes #634
2014-01-06 16:07:56 -06:00
kpdecker c73aceb3d3 Refactor out pushParams method
Simplifies hash and param push logic
2014-01-06 14:41:23 -06:00
kpdecker daeecf825c Track stringParams mode in local state vars 2014-01-06 02:55:13 -06:00
kpdecker fc60f16475 Fix DATA value in stringParams mode
Fixes #699
2014-01-06 02:45:09 -06:00
Blake Embrey 3d9685c6a2 Remove redundant conditions. 2014-01-05 12:14:24 -05:00
kpdecker 6d996ef270 Simplify ambiguous code
Remove if conditional in favor of boolean failover.
2014-01-04 09:19:58 -06:00
kpdecker 0c6829f8af v1.3.0 2014-01-01 22:10:31 -06:00
kpdecker e0d0ad5027 Merge branch 'compiler-options' of github.com:blakeembrey/handlebars.js into blakeembrey-compiler-options
Conflicts:
	lib/handlebars/compiler/javascript-compiler.js
2014-01-01 19:38:31 -06:00
kpdecker 6e4e1f8404 Include line info in compiler thrown exceptions
Fixes #636
2014-01-01 19:14:51 -06:00
kpdecker 3c85720137 Remove duplication from generated subexpressions 2014-01-01 18:59:21 -06:00
kpdecker e7e94dc697 Whitespace cleanup 2013-12-31 21:20:59 -06:00
kpdecker c1a93d33e7 Use literal for data lookup 2013-12-31 21:19:00 -06:00
kpdecker cd885bf855 Add stack handling sanity checks 2013-12-31 21:18:48 -06:00
kpdecker ddfe457abf Fix stack id "leak" on replaceStack 2013-12-31 21:17:50 -06:00
kpdecker f4d337d252 Fix incorrect stack pop when replacing literals 2013-12-31 21:17:16 -06:00
kpdecker af3358d195 Fix multiple hash handling in subexpressions 2013-12-31 16:10:51 -06:00
kpdecker f2df220a1f Add location tracking to sexpr 2013-12-31 13:31:47 -06:00
machty b09333db79 Added support for subexpressions
Handlebars now supports subexpressions.

    {{foo (bar 3)}}

Subexpressions are always evaluated as helpers; if
`3` were omitted from the above example, `bar`
would be invoked as a param-less helper, even
though a top-levell `{{bar}}` would be considered
ambiguous.

The return value of a subexpression helper is
passed in as a parameter of a parent subexpression
helper, even in string params mode. Their type,
as listed in `options.types` or `options.hashTypes`
in string params mode, is "sexpr".

The main conceptual change in the Handlebars code
is that there is a new AST.SexprNode that manages
the params/hash passed into a mustache, as well
as the logic that governs whether that mustache
is a helper invocation, property lookup, etc.
MustacheNode, which used to manage this stuff,
still exists, but only manages things like
white-space stripping and whether the mustache
is escaped or not. So, a MustacheNode _has_
a SexprNode.

The introduction of subexpressions is fully
backwards compatible, but a few things needed
to change about the compiled output of a template
in order to support subexpressions. The main one
is that the options hash is no longer stashed in
a local `options` var before being passed to
either the helper being invoked or the
`helperMissing` fallback. Rather, the options
object is inlined in these cases. This does
mean compiled template sizes will be a little
bit larger, even those that don't make use of
subexpressions, but shouldn't have any noticeable
impact on performance when actually rendering
templates as only one of these inlined objects
will actually get evaluated.
2013-12-30 19:07:04 -05:00
Kevin Decker ac98e7b177 Merge pull request #694 from blakeembrey/compile-env
Make the environment reusable
2013-12-29 15:23:47 -08:00
kpdecker 14d1d4270f Fix ProgramNode parameter handling under IE 2013-12-29 17:16:59 -06:00
Blake Embrey 150e55aa00 Pull options out from param setup to allow easier extension. 2013-12-28 22:31:45 -05:00
Blake Embrey 2f0c96b618 Make the environment reusable. 2013-12-28 21:35:40 -05:00
Stanley Stuart e1878050b5 add line numbers to nodes when parsing
closes #691
2013-12-28 18:55:36 -06:00
kpdecker 1c0614bd88 v1.2.1 2013-12-26 16:25:42 -06:00
Kevin Decker 2dae244185 Merge pull request #684 from blakeembrey/javascript-variable
Allow any number of trailing characters for valid JavaScript variable
2013-12-25 10:12:11 -08:00