summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/compiler.js
Commit message (Collapse)AuthorAgeFilesLines
* Add explicitPartialContext compiler flagkpdecker2015-09-011-1/+5
| | | Fixes #1032
* Implement block decoratorskpdecker2015-08-221-0/+13
| | | | These allow for a given block to be wrapped in helper methods or metadata and allow for more control over the current container and method before the code is run.
* Implement partial blockskpdecker2015-08-221-2/+12
| | | | | | This allows for failover for missing partials as well as limited templating ability through the `{{> @partial-block }}` partial special case. Partial fix for #1018
* Improve sanity checks in compiler and visitorkpdecker2015-08-221-0/+5
|
* Drop AST constructors in favor of JSONkpdecker2015-08-181-1/+8
| | | | | These were little more than object literal statements that were less clear due to their use of index-based arguments. Fixes #1077
* Pass undefined fields to helpers in strict modekpdecker2015-08-031-3/+7
| | | | | 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
* Handle this references properly in track id modekpdecker2015-08-031-2/+3
|
* Increase code coveragekpdecker2015-08-011-0/+1
|
* Update for let and optional parameterskpdecker2015-04-201-50/+50
|
* Add full support for es6kpdecker2015-04-161-24/+30
| | | | | | | | 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
* Add undefined and null literal supportkpdecker2015-04-071-0/+8
| | | | | This adds the UndefinedLiteral and NullLiteral to AST. Fixes #990
* Fix typokpdecker2015-02-101-1/+1
|
* Handle all potential literal valueskpdecker2015-02-091-5/+9
| | | Adds support for literal helper names in a few missing cases such as block expressions and subexpressions.
* Transform literals to path expressions in mustache nodesMarcio Junior2015-02-081-5/+9
|
* Test compilation of literal values in mustachesMarcio Junior2015-02-081-1/+5
|
* Avoid direct references to sexpr in statementskpdecker2015-01-181-18/+12
| | | | | 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-2/+8
| | | | | | | | | Uses the subexpression syntax to allow for dynamic partial lookups. Ex: ``` {{> (helper) }} ``` Fixes #933
* Fix block param evaluation under older IEkpdecker2014-12-271-2/+2
|
* Implement block parameterskpdecker2014-12-261-16/+49
| | | Fixes #907
* Expose AST helpers in public APIkpdecker2014-12-211-21/+5
|
* Avoid unnecessary this. referencekpdecker2014-12-161-3/+3
|
* Fix remaining depth argkpdecker2014-12-161-1/+0
|
* Remove unused vars and add jshint checkingkpdecker2014-12-161-3/+1
|
* Remove Compiler.depths parameterkpdecker2014-12-161-15/+5
| | | | This is no longer necessary with the depths array tracking and adds compiler overhead.
* Move compileProgram out of visitor methodskpdecker2014-11-291-18/+18
|
* Track source node via accept call rather vs opcodekpdecker2014-11-291-41/+46
|
* s/Subexpression/SubExpression/kpdecker2014-11-291-1/+1
|
* Treat partial exec in a manner closer to helperskpdecker2014-11-271-17/+8
| | | This helps unify the code handling and will also be needed to support string/id tracking on partials.
* Update subexpression and hash AST constructskpdecker2014-11-271-64/+54
|
* Simplify Path and Sexpr calculated flagskpdecker2014-11-271-4/+36
|
* Replace DataNode and IdNode with PathNodekpdecker2014-11-261-15/+24
| | | 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 literal ast nodes for new speckpdecker2014-11-261-7/+7
|
* Update statement node ASTskpdecker2014-11-261-49/+50
|
* Update MustacheNode for new AST structurekpdecker2014-11-261-1/+1
|
* Update ProgramNode to better match SpiderMonkeykpdecker2014-11-261-7/+7
|
* Update AST location info to match SpiderMonkeykpdecker2014-11-261-7/+3
| | | Part of #889
* Merge branch 'remove-block-mustache' of github.com:mmun/handlebars.js into ↵kpdecker2014-11-081-2/+1
|\ | | | | | | | | | | | | | | mmun-remove-block-mustache Conflicts: lib/handlebars/compiler/helpers.js spec/parser.js
| * Simplify BlockNode by removing intermediate MustacheNodeMartin Muñoz2014-11-021-2/+1
| |
* | Include location information in all opcodeskpdecker2014-11-081-45/+49
|/
* Add preventIndent option for partialskpdecker2014-11-021-1/+6
| | | | | 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
* Prune unused codekpdecker2014-08-251-1/+1
|
* Allow passing depths to _childkpdecker2014-08-251-2/+2
|
* Optimize compiler opcode callkpdecker2014-08-241-1/+3
|
* Move strip processing into AST helper logickpdecker2014-08-231-13/+1
| | | | | 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
* Replace string value rather than add omit flagkpdecker2014-08-231-1/+1
|
* Fix compiler program de-dupingkpdecker2014-08-141-9/+19
|
* Drop unused Compiler.disassemble methodkpdecker2014-08-141-24/+0
|
* Drop unused DECLARE opcodekpdecker2014-08-141-4/+0
|
* Implement recursive field lookup in compat modekpdecker2014-08-131-1/+7
| | | | | | 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.
* Create contextName helper for context lookupkpdecker2014-08-131-1/+2
|
* Render indent for standalone partialskpdecker2014-08-121-1/+1
|
* Drop omitted content tags from generated outputkpdecker2014-08-121-1/+3
|
* Do not lookup pathed helpers on the helper stackkpdecker2014-07-121-1/+1
| | | | Fixes #764
* Use ID lookup for ambiguous helper evaluationkpdecker2014-07-071-0/+2
| | | Final change for #731
* Rework lookup null protector logickpdecker2014-07-061-10/+5
| | | | | | | - 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
* Expose setup wrappers for compiled templateskpdecker2014-05-191-2/+8
|
* Pass full id to helperMissingTom Dale2014-05-131-1/+1
|
* Fix evaluation of paths and subexprskpdecker2014-03-051-3/+1
| | | Fixes #743
* properly handle multiple subexpressions in the same hash, fixes #748Jon Jensen2014-02-201-6/+6
| | | | | push all hash params before popping any so as to avoid the last stackN var stomping previous ones
* Add child accessor APIkpdecker2014-02-091-1/+8
|
* Add support for depthed resolution of data fieldskpdecker2014-02-091-5/+1
|
* Implement lookup helperkpdecker2014-02-091-1/+2
|
* Add trackIds compiler flagkpdecker2014-01-171-0/+4
| | | | Allows helpers that care about where a particular field came from derive this data while maintaining backward compatibility with existing helpers.
* Fix missing parameters for pathed mustacheskpdecker2014-01-171-1/+3
| | | Fixes #658
* Allow decimal number valueskpdecker2014-01-171-2/+2
| | | Fixes #472
* Implement partial hash evaluationkpdecker2014-01-171-2/+8
|
* Include name option for all helper callskpdecker2014-01-061-1/+1
| | | | | | | | 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
* Refactor out pushParams methodkpdecker2014-01-061-34/+19
| | | Simplifies hash and param push logic
* Track stringParams mode in local state varskpdecker2014-01-061-2/+3
|
* Simplify ambiguous codekpdecker2014-01-041-0/+1
| | | | Remove if conditional in favor of boolean failover.
* Include line info in compiler thrown exceptionskpdecker2014-01-011-3/+2
| | | Fixes #636
* Remove duplication from generated subexpressionskpdecker2014-01-011-1/+1
|
* Added support for subexpressionsmachty2013-12-301-44/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Make the environment reusable.Blake Embrey2013-12-281-12/+9
|
* Export AST as an object rather than modulekpdecker2013-12-011-1/+1
| | | The parser expects the AST object to be mutable, which modules are not.
* Wrap AST nodes in strip opcodes if definedkpdecker2013-10-141-2/+14
|
* Use accept for all compiler traversalkpdecker2013-10-141-4/+3
|
* Use template env and compile methodskpdecker2013-10-091-3/+2
|
* Use proper default vs. module import semanticskpdecker2013-10-011-7/+5
|
* Break exception class out into a standalone modulekpdecker2013-10-011-1/+1
|
* Make the Handlebars environment into an objectYehuda Katz2013-07-261-3/+3
| | | | | | | | The idea is that the environment wraps up the mutable stuff in Handlebars (like the helpers) and that you could theoretically create a new one at any time and pass it in to Handlebars.template. Every test makes a new environment and uses it in template compilation.
* Further progress towards modularization.Yehuda Katz2013-07-241-6/+8
| | | | | 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.
* Building an AMD fileYehuda Katz2013-07-161-2/+1
|
* Initial work on ES6 modulesYehuda Katz2013-07-011-25/+21
|
* Break JavascriptCompiler into standalone filekpdecker2013-06-031-844/+2
|
* Merge global and passed helpers and partialskpdecker2013-05-311-2/+3
|
* Allow execution of helpers on the contextkpdecker2013-05-301-1/+2
| | | Fixes #285
* Protect from object prototype modificationskpdecker2013-05-281-1/+3
| | | | Fixes #534
* Add support for complex ids in @data referenceskpdecker2013-05-271-2/+10
|
* Merge pull request #454 from leshill/fix_string_mode_contextsKevin Decker2013-04-071-2/+13
|\ | | | | Add contexts for string mode hash values
| * Add contexts for string mode hash valuesLes Hill2013-03-191-2/+13
| | | | | | | | Allows for evaluating hash parameters such as ../city in string mode.
* | Merge branch 'program-metadata'kpdecker2013-04-071-6/+1
|\ \
| * | Add program metadatakpdecker2013-02-171-6/+1
| |/ | | | | | | | | | | Include program id and depth on the generated wrapper objects. This allows helpers who are passed these objects to differentiate between helpers for cases where they may want to cache the generated DOM structure.
* | Restore knownHelpersOnly throwkpdecker2013-04-061-1/+1
| | | | | | Fixes #302
* | Allow compilation of empty stringkpdecker2013-04-061-2/+2
| | | | | | Fixes #461
* | Escape unicode newlines in string literalskpdecker2013-04-061-1/+3
|/ | | Fixes #375
* Fix #428 nested if else renderingkpdecker2013-02-161-0/+11
| | | | The program equality checker was not taking children into account when determining equality, causing breakages under similar cases.
* Merge pull request #442 from tricknotes/fix-method-name-in-error-messageKevin Decker2013-02-161-1/+1
|\ | | | | Fix method name in error message
| * Fix method name in error messageRyunosuke SATO2013-02-161-1/+1
| | | | | | | | - compile -> precompile
* | Use local varskpdecker2013-02-161-4/+4
| |