summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/compiler.js
Commit message (Collapse)AuthorAgeFilesLines
* 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
| |
* | Remove unnecessary child scopeskpdecker2013-02-161-1043/+1040
|/
* mergeTommy Messbauer2013-02-111-83/+284
|\
| * Better error messages for precompiler runtime mismatchPeter Wagenet2013-02-091-1/+3
| |
| * Decouple compiler version checks from release versionsPeter Wagenet2013-02-081-1/+1
| |
| * Handlebars.parse/precompile/compile can now be passed an already-compiled ↵machty2013-02-071-8/+8
| | | | | | | | Handlebars AST.
| * Improved precompile template version checkPeter Wagenet2013-01-301-4/+1
| | | | | | | | | | This check reduces duplicated code as well as also failing if the template was precompiled on a version before the check was added.
| * Check version when evaluating templates.Peter Wagenet2013-01-291-0/+7
| | | | | | | | | | This makes sure that we throw an error when a template was precompiled with a version of Handlebars that doesn't match the evaluating version.
| * mergeSource helperkpdecker2013-01-211-10/+14
| |
| * Merge duplicate programskpdecker2013-01-211-6/+43
| |
| * Remove inline option from pushStackkpdecker2013-01-211-13/+9
| |
| * Use push rather than pushStack for inline opskpdecker2013-01-211-11/+11
| |
| * Make replaceStack always inlinekpdecker2013-01-201-6/+6
| |
| * Formatting updates for inlined contentkpdecker2013-01-201-2/+2
| |
| * Merge consecutive buffer appendskpdecker2013-01-201-10/+30
| |
| * Use options register for blockHelperMissingkpdecker2013-01-201-4/+9
| |
| * Inline known helper callskpdecker2013-01-201-1/+1
| |
| * Use stack rather than register for invoke lookupkpdecker2013-01-201-4/+6
| |
| * Prevent duplication of inline content in appendkpdecker2013-01-201-0/+3
| |
| * Update 2nd level opcodes to use inlineskpdecker2013-01-191-11/+19
| |
| * Allow replaceStack to work with the inline stackkpdecker2013-01-191-8/+35
| |
| * Use inline values for simple terminalskpdecker2013-01-191-4/+5
| |
| * Inline stack helper implementationkpdecker2013-01-191-16/+48
| |
| * Merge branch 'master' into inline-opskpdecker2013-01-191-4/+3
| |\
| | * Remove unused varskpdecker2013-01-191-4/+3
| | |
| * | Reuse stack var to avoid registerkpdecker2013-01-191-2/+1
| | |
| * | Output options only once to unknownHelper casekpdecker2013-01-191-6/+12
| | |
| * | Empty hash literal outputkpdecker2013-01-191-4/+11
| | |
| * | Inline foundHelper lookupkpdecker2013-01-191-4/+4
| |/
| * Must pop the stack extra for hashestomhuda2013-01-181-0/+1
| |
| * Add support for getting types in string modeYehuda Katz2013-01-161-10/+39
| | | | | | | | | | This makes it possible to determine whether an argument was passed as a string or as a path when implementing helpers in string mode.
| * Prevent write on all depth variableskpdecker2013-01-131-1/+1
| |
| * Prevent context overwrite by replaceStackkpdecker2013-01-131-7/+14
| | | | | | Fixes #408.
| * Remove duplicate assignmentkpdecker2013-01-131-1/+1
| |
| * Removed unnecessary semicolon, which is needed to pass JSHint for compiled codeAndrey Lushchick2012-12-271-1/+1
| |
| * Merge pull request #389 from leshill/partial_namesYehuda Katz2012-12-231-2/+2
| |\ | | | | | | Partials can be paths
| | * Partials can be pathsLes Hill2012-12-131-2/+2
| | | | | | | | | | | | | | | | | | Allows partials with slashes, a common partial syntax. For example: {{> shared/dude}}
| * | Merge pull request #390 from eastridge/masterYehuda Katz2012-12-231-2/+6
| |\ \ | | | | | | | | Make {data: true} a default compile option
| | * | Add data = true as default optionRyan Eastridge2012-12-131-2/+6
| | |/
| * | Get a better error for compile(falsy)Yehuda Katz2012-12-231-0/+8
| |/