kpdecker
f30b3ea329
Allow whitespace control on comments
...
This changes the call signature for the CommentNode constructor, which is a potentially breaking change for AST users.
Fixes #866
2014-11-02 11:55:52 -06:00
kpdecker
ca1486b960
Prune unused code
2014-08-25 22:39:17 -05:00
kpdecker
0528b91644
Add original value tracking to ContentNode
2014-08-23 16:33:14 -05:00
kpdecker
529e2b6796
Merge branch 'refactor-parser' of github.com:mmun/handlebars.js into mmun-refactor-parser
...
Conflicts:
lib/handlebars/compiler/ast.js
spec/ast.js
src/handlebars.yy
2014-08-23 16:29:22 -05:00
kpdecker
50c657f138
Flag standalone nodes in the AST
2014-08-12 14:41:58 -05:00
kpdecker
6070179009
Track root status in ProgramNode constructor
2014-08-12 14:41:58 -05:00
Martin Muñoz
eee2c4d4f2
Refactor blocks, programs and inverses
2014-07-29 02:45:50 -04:00
Martin Muñoz
356ea1a909
Ensure isHelper is coerced to a boolean
2014-05-05 01:51:29 -04: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
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
f90981adf6
Add partial hash parser support
2014-01-17 17:51:52 -06:00
kpdecker
fc60f16475
Fix DATA value in stringParams mode
...
Fixes #699
2014-01-06 02:45:09 -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
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
kpdecker
14d1d4270f
Fix ProgramNode parameter handling under IE
2013-12-29 17:16:59 -06:00
Stanley Stuart
e1878050b5
add line numbers to nodes when parsing
...
closes #691
2013-12-28 18:55:36 -06:00
kpdecker
b4968bb8d4
Fix handling of boolean escape in MustacheNode
...
Fixes issue with Ember compatibility due to direct instantiation of MustacheNode.
2013-12-23 19:02:24 -06:00
kpdecker
3daef9d308
Use charAt rather than string index
...
Older versions of IE do not support [] access to string contents so charAt must be used.
Fixes #677
2013-12-23 02:18:57 -06:00
kpdecker
078c1eecba
Export AST as an object rather than module
...
The parser expects the AST object to be mutable, which modules are not.
2013-12-01 11:37:25 -06:00
kpdecker
1de6cee1b2
Load strip flags from lex stream
2013-10-14 22:50:50 -05:00
kpdecker
0cc6e270f9
Pass open token to MustacheNode for flag parsing
2013-10-14 22:50:12 -05:00
kpdecker
4d7124f6bf
Remove global Handlebars references
2013-10-09 03:21:21 -07:00
kpdecker
e676e43dc5
Use proper default vs. module import semantics
2013-10-01 21:19:49 -05:00
kpdecker
6a23391a9a
Break exception class out into a standalone module
2013-10-01 21:14:18 -05:00
Yehuda Katz
f5c8484ea0
Further progress towards modularization.
...
At this point, I have only 2 fails in the Node build, but I'm doing a
bunch of manual stuff locally and still have a bunch of hacks.
2013-07-24 05:03:27 +00:00
Yehuda Katz
88ee4757e7
Initial work on ES6 modules
2013-07-01 13:59:58 -07:00
kpdecker
6174c3b6f8
Remove unnecessary function
2013-06-02 23:36:34 -05:00
kpdecker
da2aabe7bd
Allow ID, STRING, or INTEGER for partial name
...
Fixes #519
2013-05-29 10:46:28 -04:00
kpdecker
503e32208b
Improve tracking of original path values
2013-05-27 19:47:17 -04:00
kpdecker
8a05dcb70e
Remove unused scope function
2013-02-16 10:47:04 -06:00
Tommy Messbauer
1ca7462497
merge
2013-02-11 23:00:47 -06:00
Tommy Messbauer
514c9391e0
restored scope of var verifyMatch
2013-02-11 22:50:23 -06:00
Les Hill
6ab92eee6d
Only allow 'this' or '..' to lead a path
...
Paths like 'outer/../key' raise an exception when compiling.
2013-01-21 11:21:43 -08:00
tomhuda
ce82bef6f1
Boolean("false") === true
2013-01-18 16:42:27 -08:00
Yehuda Katz
ccd6a22ea5
Add support for getting types in string mode
...
This makes it possible to determine whether an
argument was passed as a string or as a path
when implementing helpers in string mode.
2013-01-16 22:43:25 -08:00
Les Hill
4bb794d814
Partials can be paths
...
Allows partials with slashes, a common partial syntax. For example:
{{> shared/dude}}
2012-12-13 11:15:38 -08:00
Tommy Messbauer
7963218495
Factory update with tabs to spaces.. sorry :(
2012-11-26 09:39:08 -06:00
Tommy Messbauer
7c4813b417
Commiting initial factory code
2012-08-29 12:48:22 -05:00
Yehuda Katz
72e05d623c
Add support for @data variables
2012-07-05 22:43:05 -07:00
tomhuda
0afc8b58d2
Clean up parser tests and AST printer
2012-05-28 19:06:26 -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
kpdecker
4a9270aa38
Fix module loading within node
2011-07-30 12:18:56 -05:00
kpdecker
2fc01ff73a
Move art into compiler dir
2011-07-30 10:25:30 -05:00