summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Allow for escaped ] characters in [] IDskpdecker2015-09-161-1/+1
| | | | | | | | Allows for ] literal characters to be used within [] IDs by prefixing them with the \ character. `\` literal at the end of the may be referenced by the `\\` sequence if conflicting. Under most circumstances the `\\` sequence will continue to work. Potentially breaking change for users of [] ids that have `\\` anywhere in the id or `\` at the end of the id. Fixes #1092
* Add decorator parsingkpdecker2015-08-222-3/+3
|
* Create validateClose helper methodkpdecker2015-08-221-1/+1
| | | | Avoid duplicating the logic needed to check for close block mismatches.
* Implement partial blockskpdecker2015-08-222-0/+8
| | | | | | This allows for failover for missing partials as well as limited templating ability through the `{{> @partial-block }}` partial special case. Partial fix for #1018
* Drop AST constructors in favor of JSONkpdecker2015-08-181-14/+43
| | | | | These were little more than object literal statements that were less clear due to their use of index-based arguments. Fixes #1077
* Fix parser declaration under amd buildskpdecker2015-08-031-1/+1
|
* Increase code coveragekpdecker2015-08-011-1/+2
|
* Added comment about Jison's topState()Eric Nielsen2015-07-191-0/+3
|
* #1056 Fixed grammar for nested raw blocksEric Nielsen2015-07-152-4/+10
|
* Fix location information for programskpdecker2015-06-261-2/+2
| | | | | | | | There appears to be a bug in our use of jison causing the parent location information to be reported to programs. I wasn’t able to work through what might be causing this so instead using the location information of the statements collection to generate the proper location information. This is a bit of a hack but we are very far behind on the Jison release train and upgrading will likely be a less than pleasant task that doesn’t provide us much benefit. Fixes #1024
* Remove jshint completelykpdecker2015-04-272-2/+0
|
* Allow this references in literal statementskpdecker2015-04-142-5/+5
| | | Fixes #967
* Allow undefined and null in helper nameskpdecker2015-04-131-2/+2
|
* Add undefined and null literal supportkpdecker2015-04-072-0/+4
| | | | | This adds the UndefinedLiteral and NullLiteral to AST. Fixes #990
* Handle all potential literal valueskpdecker2015-02-091-7/+3
| | | Adds support for literal helper names in a few missing cases such as block expressions and subexpressions.
* Boolean literals can be passed to mustachesMarcio Junior2015-02-081-0/+1
|
* Avoid direct references to sexpr in statementskpdecker2015-01-181-19/+18
| | | | | 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.
* Add support for dynamic partial nameskpdecker2015-01-181-1/+7
| | | | | | | | | Uses the subexpression syntax to allow for dynamic partial lookups. Ex: ``` {{> (helper) }} ``` Fixes #933
* Allow blockParams on chained inverse statementskpdecker2014-11-291-1/+1
|
* Rework strip flags to make clearer at in AST levelkpdecker2014-11-281-9/+8
| | | Rather than keeping state in the AST, which requires some gymnastics, we create a separate visitor flow which does the top down iteration necessary to calculate all of the state needed for proper whitespace control evaluation.
* Move Jison parsing out of AST into helperskpdecker2014-11-281-7/+7
|
* Rename AST objects to match type nameskpdecker2014-11-281-18/+18
|
* Update subexpression and hash AST constructskpdecker2014-11-271-1/+1
|
* Simplify Path and Sexpr calculated flagskpdecker2014-11-271-1/+1
|
* Replace DataNode and IdNode with PathNodekpdecker2014-11-261-2/+2
| | | 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.
* Update statement node ASTskpdecker2014-11-261-7/+6
|
* Update MustacheNode for new AST structurekpdecker2014-11-261-3/+3
|
* Update ProgramNode to better match SpiderMonkeykpdecker2014-11-261-1/+1
|
* Update AST location info to match SpiderMonkeykpdecker2014-11-261-24/+24
| | | Part of #889
* Add parser support for block paramsMartin Muñoz2014-11-112-6/+11
|
* Merge branch 'remove-block-mustache' of github.com:mmun/handlebars.js into ↵kpdecker2014-11-081-5/+9
|\ | | | | | | | | | | | | | | mmun-remove-block-mustache Conflicts: lib/handlebars/compiler/helpers.js spec/parser.js
| * Simplify BlockNode by removing intermediate MustacheNodeMartin Muñoz2014-11-021-5/+9
| |
* | Merge pull request #892 from wycats/else-ifKevin Decker2014-11-082-2/+18
|\ \ | |/ |/| Implement parser for else chaining of helpers
| * Implement parser for else chaining of helperskpdecker2014-10-272-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allows users to chain multiple helpers together using their inverse callbacks. I.e. ``` {{#if foo}} {{else if bar}} {{else}} {{/if}} ``` The control flow here effectively causes the helpers to be nested. The above is actually syntactic sugar for this: ``` {{#if foo}} {{else}} {{#if bar}} {{else}} {{/if}} {{/if}} ``` Any helper may be used in this manner, the only requirement is they support normal calls and inverse calls. Introduces a breaking change in that `{{else foo}}` may no longer be used as a root level operator. Instead `{{^foo}}` must be used. Fixes #72.
* | Allow whitespace control on commentskpdecker2014-11-022-4/+14
|/ | | | | This changes the call signature for the CommentNode constructor, which is a potentially breaking change for AST users. Fixes #866
* Refactor content blocks to ignore lineskpdecker2014-08-251-2/+2
| | | | | We can simplify our previous standalone determination logic by merging content blocks again. Fixes #854
* Cleanup from code coverage reportkpdecker2014-08-231-0/+1
|
* Merge branch 'refactor-parser' of github.com:mmun/handlebars.js into ↵kpdecker2014-08-232-39/+27
|\ | | | | | | | | | | | | | | | | mmun-refactor-parser Conflicts: lib/handlebars/compiler/ast.js spec/ast.js src/handlebars.yy
| * Refactor blocks, programs and inversesMartin Muñoz2014-07-292-36/+28
| |
* | Increase test coverage a touchkpdecker2014-08-141-5/+0
| |
* | Track root status in ProgramNode constructorkpdecker2014-08-121-8/+8
| |
* | Parse context sections by linekpdecker2014-08-121-2/+2
|/
* Make raw blocks operate like blockskpdecker2014-02-092-3/+11
|
* raw block helpersJesse Ezell2014-02-092-2/+11
|
* Add {{{{ }}}} for raw blocksJesse Ezell2014-02-092-1/+7
|
* Allow decimal number valueskpdecker2014-01-172-3/+3
| | | Fixes #472
* Add partial hash parser supportkpdecker2014-01-171-1/+2
|
* Add location tracking to sexprkpdecker2013-12-311-2/+2
|
* Added support for subexpressionsmachty2013-12-302-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* add line numbers to nodes when parsingStanley Stuart2013-12-281-26/+26
| | | | closes #691
* Merge branch 'fix-escapes' of github.com:dmarcotte/handlebars.js into ↵kpdecker2013-12-231-3/+3
|\ | | | | | | | | | | | | dmarcotte-fix-escapes Conflicts: spec/tokenizer.js
| * Fix "\\{{" immediately following "\{{"Daniel Marcotte2013-11-061-3/+3
| | | | | | | | | | | | | | | | | | Escaped-escape mustaches ("\\{{") immediately following escaped mustaches ("\{{") were being handled incorrectly. Fix the lookahead to make sure yytext still contains the appropriate slashes when we pop out of <emu> so they can be handled consistently by the initial state.
* | Use charAt rather than string indexkpdecker2013-12-231-2/+2
| | | | | | | | | | Older versions of IE do not support [] access to string contents so charAt must be used. Fixes #677
* | Run jshint on outputkpdecker2013-12-013-1/+3
|/ | | Allows us to execute jshint in non-forced mode.
* Fix empty string compilationkpdecker2013-11-041-0/+1
|
* Use ~ rather than () for whitespace control.kpdecker2013-10-142-6/+6
|
* Load strip flags from lex streamkpdecker2013-10-141-10/+21
|
* Add strip token parsing to lexerkpdecker2013-10-141-12/+14
|
* Fix whitespacekpdecker2013-10-141-1/+1
|
* Lookahead control classeskpdecker2013-10-141-5/+8
|
* Pass open token to MustacheNode for flag parsingkpdecker2013-10-141-7/+6
|
* Fix "\\" escapingDaniel Marcotte2013-10-131-3/+9
| | | | | Previously, "\\{{foo}}" would only result in the desired "\fooValue" if it was at the beginning of the file or immediately after a close stache.
* Generate parser as es6 modulekpdecker2013-10-012-5/+1
|
* Simplify inverse only block casekpdecker2013-07-301-1/+1
|
* Add strip lex helper methodkpdecker2013-07-291-8/+16
|
* ID lexer control classkpdecker2013-07-291-10/+12
|
* Prevent nonsensical root {{^}}kpdecker2013-07-241-1/+1
|
* Remove braces on single line lex statementskpdecker2013-07-241-32/+32
| | | Resolves a parsing issue in the 0.4 branch of jison.
* Use ebnf iteration/optional inMustachekpdecker2013-07-241-9/+1
|
* Use ebnf optional for partial pathkpdecker2013-07-241-2/+1
|
* Use ebnf iteration for hash productionkpdecker2013-07-241-6/+1
|
* Use param production for hash valuekpdecker2013-07-241-5/+1
|
* Use arrow syntax for bnfkpdecker2013-07-241-43/+45
|
* Require matching braces in escaped expressionskpdecker2013-05-292-4/+7
| | | Fixes #437
* Allow ID, STRING, or INTEGER for partial namekpdecker2013-05-292-5/+5
| | | Fixes #519
* Improve tracking of original path valueskpdecker2013-05-271-2/+2
|
* Add support for complex ids in @data referenceskpdecker2013-05-272-4/+8
|
* Add unicode support for ID tokenskpdecker2013-05-271-2/+13
| | | | Fixes #433 Fixes #469
* Allowed for points to be in partial path nameJames Gorrie2013-05-171-2/+2
|
* Add regex escapeskpdecker2013-05-101-2/+2
|
* Merge pull request #462 from broady/masterKevin Decker2013-04-061-1/+1
|\ | | | | Fix support for Rhino
| * Fix Rhino supportChris Broadfoot2013-03-041-1/+1
| |
* | Merge branch 'master' of github.com:jpfiset/handlebars.js into jpfiset-masterkpdecker2013-04-061-2/+2
|\ \
| * | Allow colon characters in identifiersJean-Pierre Fiset2013-03-041-1/+1
| | | | | | | | | Issue #460
| * | Allow accessing properties in current context using paths. This is toJean-Pierre Fiset2013-03-041-1/+1
| |/ | | | | | | | | avoid name collisions with registered helper functions. Issue #458
* | Add support for \\{ escapeskpdecker2013-03-311-0/+1
|/ | | Fixes #456
* Negative number literal supportkpdecker2013-02-151-1/+1
| | | Fixes #422
* Use jsmodule for jison parserkpdecker2013-01-132-0/+5
| | | | | Removes unnecessary commonjs code generated for the parser. This reduces the size of the parse by about 700bytes and should resolve lookup issues with browserify and other static analysis tools. See #220
* Merge pull request #388 from dmarcotte/empty-inverse-blocksYehuda Katz2012-12-231-1/+4
|\ | | | | Allow empty blocks around simple inverses
| * Allow empty blocks around simple inversesDaniel Marcotte2012-12-111-1/+4
| | | | | | | | | | | | | | | | Previously, the parser required at least one character of whitespace to properly interpret empty blocks around simple inverses, which was non-intuitive and inconsistent with empty block parsing. Update the parser to allow empty blocks around simple inverses.
* | Partials can be pathsLes Hill2012-12-132-4/+10
|/ | | | | | Allows partials with slashes, a common partial syntax. For example: {{> shared/dude}}
* Add block comment syntax:Yehuda Katz2012-10-151-1/+4
| | | | {{!-- can contain {{handlebars expressions}} --}}
* Escaped single quotes in hash argumentsLes Hill2012-09-221-1/+1
|
* Fix repeated delimiter escapingtomhuda2012-09-121-1/+5
|
* Recognize bar='baz' hash argumentLes Hill2012-08-141-0/+1
|
* Add support for @data variablesYehuda Katz2012-07-052-0/+4
|
* More cleanuptomhuda2012-05-281-2/+2
| | | | * Make block and inverse use the main helper path * Eliminate separate inverse AST node
* Fixed error in lexerPeter Wagenet2012-02-081-1/+1
|
* Fixed whitespace and semi-colonsPeter Wagenet2012-02-081-37/+37
|
* Add support for escaping mustachesYehuda Katz2011-12-271-5/+12
|