Commit Graph

160 Commits

Author SHA1 Message Date
wycats 72fa62529e Merge branch 'master' of https://github.com/zaach/handlebars.js into zaach-master 2010-12-27 13:02:20 -08:00
wycats 16ed2cd3f1 Refactoring and performance enhancements on the VM compiler 2010-12-21 09:47:27 -08:00
wycats d87ae129c0 Add a #with helper 2010-12-21 09:47:01 -08:00
wycats 8fccd21283 escapeExpressions should return "" for falsy values 2010-12-21 09:46:50 -08:00
wycats e0246d7dfc #each should handle undefined or null values 2010-12-21 09:46:22 -08:00
wycats fc0d721b96 Use pluggable logger rather the puts 2010-12-21 09:45:59 -08:00
wycats 355565bb04 Fix missing whitespaces in error message 2010-12-21 09:39:05 -08:00
Zach Carter faea35f8fa Merging with latest master 2010-12-20 02:25:25 -05:00
wycats 8f502ffbe7 Add #each and #if built-in helpers for more readable iteration and conditionals 2010-12-19 00:06:55 -08:00
wycats f4ae0c27fe Allow reserved words to be used without slowing down most operations in browsers with faster foo.bar vs. foo['bar']. 2010-12-19 00:06:30 -08:00
wycats b418ef6eb2 Add optimized compiled version of handlebars, which should be significantly faster. Use Handlebars.VM.compile instead of Handlebars.compile to use the optimized version.
Major TODOS:

* clean up a bunch of code duplication in the compiler
* reorganize the compiler
* add support for debug symbols which would make it possible
  to provide information about what part of the source caused
  a runtime error.
2010-12-18 23:27:34 -08:00
wycats e15d675a64 Everything is working now on the new VM except for partials and inverse sections 2010-12-15 23:42:53 -08:00
Zach Carter 42414baa5c Add new visitor.js file to build dependencies 2010-12-14 19:18:35 -05:00
Zach Carter 820504bbd5 Use 'spec' task instead of 'test'. 2010-12-14 19:10:41 -05:00
Zach Carter 97536f897e Switch to Jison's lexer. 2010-12-14 19:07:05 -05:00
wycats ec948c7382 Small restructuring. Have I mentioned how much I hate having to write modules that work in both CommonJS and the browser? 2010-12-12 13:33:17 -08:00
wycats 57e72c9fd2 Added build instructions 2010-12-11 19:44:11 -08:00
wycats 00fdfc306d Add README 2010-12-11 19:42:04 -08:00
wycats eefd0deb6d Merge branch 'master' into rewrite 2010-12-11 19:11:56 -08:00
wycats 9fcd85bbac Allow helperMissing to apply to simple mustaches (paves the way to support things like link_to in a Rails context) 2010-12-11 18:43:58 -08:00
wycats 62cea5b05e Make sure rspec returns the right line number from library files 2010-12-11 18:29:05 -08:00
wycats 215754c268 Make helperMissing a built-in feature 2010-12-11 18:28:37 -08:00
wycats 5097c18912 Make it possible to register helpers and partials and then skip passing in the helpers or partials later 2010-12-11 18:10:56 -08:00
wycats fdc8e425d0 Improve compiling infrastructure, and restore a bit of duplication in spec_helper to make debugging easier in test failures 2010-12-11 18:10:26 -08:00
wycats 35b4d9fd01 linting 2010-12-04 22:26:41 -05:00
wycats 4db1abcd74 Fix up the compilation process 2010-12-04 17:35:36 -05:00
wycats f205cec745 Finish compatibility with the old handlebars:
* foo"bar" is an invalid param
* {{foo}}bar{{/baz}} is invalid
* fix a number of issues with inverse sections
* add partials
2010-12-03 16:49:04 -05:00
wycats 9a6f77af56 A few more lingering bugs:
* add helperMissing.not to the specs
* add Handlebars.Utils.isEmpty
* add runtime handling for inverse sections
* fix __get__ to pass an IdNode to evaluate
* handle case in wrapProgram where context is undefined
2010-12-03 01:39:00 -05:00
wycats c89ecf80a5 Inverse should really be its own node, as it has totally different runtime semantics 2010-12-03 01:10:14 -05:00
wycats 8f6f3051e6 Add support for inverted sections in the parser 2010-12-03 00:54:18 -05:00
wycats 87b526df27 Allow empty blocks. 2010-12-02 01:27:41 -05:00
wycats 762329913d Fix a number of outstanding issues:
* {{}} escape their contents, {{{}}} and {{& }} do not
* Add support in the parser, tokenizer and AST for partials
  with context (support is still not there in the runtime)
* Fix some inconsistencies with the old behavior involving
  the correct printing of null and undefined
* Add Handlebars.Exception
* Fixed an issue involving ./foo and this/foo
* Fleshed out helperMissing in the specs (this will be
  moved out into handlebars proper once registerHelper
  and registerPartial are added)
2010-12-02 01:13:24 -05:00
wycats 9846fb8a28 Got Qunit tests running through RSpec and fixed a bunch of bugs... 33 fails from the original suite to go 2010-11-28 17:36:05 -08:00
wycats 454d0a85b7 Add initial support for blocks 2010-11-26 23:45:38 -08:00
wycats 3b0970d8aa Start working on the runtime 2010-11-25 23:32:32 -08:00
wycats b401fc388b Test the parser, and clean up ID having multiple parts 2010-11-25 23:32:03 -08:00
wycats f8b245896d Make the ID node capable of handling paths
TODO: handle invalid paths in the tokenizer or parser
  TODO: invalidate "{{ foo/ bar }}"
2010-11-25 16:12:50 -08:00
wycats 7d0204bf9f Add some more tests, and properly handle errors across the boundary in tests 2010-11-25 16:09:42 -08:00
wycats 4624eddf0b The tokenizer shouldn't get into an infinite loop in certain termination conditions 2010-11-25 12:46:25 -08:00
wycats 3388962225 Fix the lexer to handle Strings with escaped quotes 2010-11-25 11:54:09 -08:00
wycats 83fa737e04 Add tests for the tokenizer using RubyRacer 2010-11-25 11:53:41 -08:00
wycats 4b2e543d2e Remove node dependency from handlebars.js 2010-11-25 11:52:35 -08:00
wycats 7100563373 Add a Gemfile for testing 2010-11-25 11:51:50 -08:00
wycats d97bc591a2 Restructure files to make more sense in a non-CommonJS world. 2010-11-25 02:49:08 -08:00
wycats 38f8ae84fe Explain something in the lexer 2010-11-25 00:58:42 -08:00
wycats 85fa2cb65f Initial commit. Note that I'm using CommonJS modules and node purely to help me develop this. If this ends up being useful, I will likely distribute the entire package as a single JS file for easier consumption in the browser. 2010-11-25 00:50:57 -08:00
Alan Johnson d2b8e0296d Got rid of log messages for debugging. 2010-11-20 22:03:00 -05:00
Alan Johnson 4b4c13f40d More work on context object. Just one more failing test. 2010-11-20 21:40:35 -05:00
Alan Johnson aa976283db Just two more failing tests on the new constext object rewrite. 2010-11-20 17:08:06 -05:00
Alan Johnson 38d2be4cc0 Working on getting context object working. 2010-11-20 15:26:28 -05:00