Skip to content

Commit

Permalink
Merge pull request #150 from janl/rewrite
Browse files Browse the repository at this point in the history
Parser rewrite

fixes #145
fixes #148
fixes #141
fixes #67
fixes #147
fixes #94
fixes #77
fixes #122
fixes #79
  • Loading branch information
mjackson committed Jan 11, 2012
2 parents 5df7be5 + 931749f commit e24885c
Show file tree
Hide file tree
Showing 97 changed files with 692 additions and 626 deletions.
1 change: 0 additions & 1 deletion .gitignore
@@ -1,7 +1,6 @@
.DS_Store
.rvmrc
runner.js
lib
jquery.mustache.js
qooxdoo.mustache.js
dojox
Expand Down
65 changes: 34 additions & 31 deletions CHANGES.md
@@ -1,49 +1,52 @@
# mustache.js Changes

## 0.5.0-dev (1/11/2012)

* Complete rewrite
* Removed support for pragmas

## 0.3.1-dev-twitter-b (8/23/2011)

* Cached regexes for improved performance
* Cached regexes for improved performance

## 0.3.1-dev-twitter (12/3/2010)

* fixed double-rendering bug
* added Rhino test-runner alongside JavaScriptCore
* Fixed double-rendering bug
* Added Rhino test-runner alongside JavaScriptCore

## 0.3.1 (??-??-????)

## 0.3.0 (21-07-2010)

* Improved whitespace handling.
* Make IMPLICIT ITERATORS a first class feature.
* Fix Rhino compat.
* CommonJS packaging is no longer a special case.
* DRY Rakefile.
* Allow whitespace around tag names.
* Fix partial scope.
* Fix Comments.
* Added inverted sections.
* Avoid double encoding of entities.
* Use sections to dereference subcontexts.
* Added higher order sections.

* Improved whitespace handling
* Make IMPLICIT ITERATORS a first class feature
* Fix Rhino compat
* CommonJS packaging is no longer a special case
* DRY Rakefile
* Allow whitespace around tag names
* Fix partial scope
* Fix Comments
* Added inverted sections
* Avoid double encoding of entities
* Use sections to dereference subcontexts
* Added higher order sections

## 0.2.3 (28-03-2010)

* Better error message for missing partials.
* Added more robust type detection.
* Parse pragmas only once.
* Throw exception when encountering an unknown pragma.
* Ignore undefined partial contexts. Returns verbatim partials.
* Added yui3 packaging.

* Better error message for missing partials
* Added more robust type detection
* Parse pragmas only once
* Throw exception when encountering an unknown pragma
* Ignore undefined partial contexts. Returns verbatim partials
* Added yui3 packaging

## 0.2.2 (11-02-2010)

* ctemplate compat: Partials are indicated by >, not <.
* Add support for {{%PRAGMA}} to enable features.
* Made array of strings an option. Enable with `{{%JSTACHE-ENABLE-STRING-ARRAYS}}`.
* mustache compat: Don't barf on unknown variables.
* Add `rake dojo` target to create a dojo package.
* Add streaming api.
* Rename JSTACHE-ENABLE-STRING-ARRAYS to IMPLICIT-ITERATOR.
* Add support for pragma options.
* ctemplate compat: Partials are indicated by >, not <
* Add support for {{%PRAGMA}} to enable features
* Made array of strings an option. Enable with `{{%JSTACHE-ENABLE-STRING-ARRAYS}}`
* mustache compat: Don't barf on unknown variables
* Add `rake dojo` target to create a dojo package
* Add streaming api
* Rename JSTACHE-ENABLE-STRING-ARRAYS to IMPLICIT-ITERATOR
* Add support for pragma options
10 changes: 5 additions & 5 deletions README.md
Expand Up @@ -3,7 +3,7 @@
> What could be more logical awesome than no logic at all?
[mustache.js](http://github.com/janl/mustache.js) is an implementation of the
[Mustache](http://mustache.github.com/) templating system in JavaScript.
[Mustache](http://mustache.github.com/) template system in JavaScript.

[Mustache](http://mustache.github.com/) is a logic-less template syntax. It can
be used for HTML, config files, source code - anything. It works by expanding
Expand Down Expand Up @@ -274,10 +274,11 @@ own iteration marker:

## Plugins for JavaScript Libraries

mustache.js may be built specifically for several different client libraries
and platforms, including the following:
By default mustache.js may be used in a browser or any [CommonJS](http://www.commonjs.org/)
environment, including [node](http://nodejs.org/). Additionally, mustache.js may
be built specifically for several different client libraries and platforms,
including the following:

- [node](http://nodejs.org/) (or other CommonJS platforms)
- [jQuery](http://jquery.com/)
- [Dojo](http://www.dojotoolkit.org/)
- [YUI](http://developer.yahoo.com/yui/)
Expand All @@ -287,7 +288,6 @@ and platforms, including the following:
These may be built using [Rake](http://rake.rubyforge.org/) and one of the
following commands:

$ rake commonjs
$ rake jquery
$ rake dojo
$ rake yui
Expand Down
9 changes: 1 addition & 8 deletions Rakefile
Expand Up @@ -13,7 +13,7 @@ task :spec do
end

def version
File.read("mustache.js").match('version: "([^\"]+)",$')[1]
File.read("mustache.js").match('version = "([^\"]+)";$')[1]
end

# Creates a rule that uses the .tmpl.{pre,post} stuff to make a final,
Expand All @@ -36,17 +36,10 @@ def templated_build(name, opts={})
sh "cat #{source}/#{target_js}.tpl.pre mustache.js \
#{source}/#{target_js}.tpl.post > #{opts[:location] || '.'}/#{target_js}"

# extra
if opts[:extra]
sh "sed -e 's/{{version}}/#{version}/' #{source}/#{opts[:extra]} \
> #{opts[:location]}/#{opts[:extra]}"
end

puts "Done, see #{opts[:location] || '.'}/#{target_js}"
end
end

templated_build "CommonJS", :location => "lib", :extra => "package.json"
templated_build "jQuery"
templated_build "Dojo", :location => "dojox/string"
templated_build "YUI3", :location => "yui3/mustache"
Expand Down
8 changes: 4 additions & 4 deletions TESTING.md
@@ -1,4 +1,4 @@
## Running the mustache.js Test Suite
## Running the mustache.js test suite

The mustache.js test suite uses the [RSpec](http://rspec.info/) testing
framework. In order to run the tests you'll need to install [Ruby](http://ruby-lang.org/)
Expand Down Expand Up @@ -57,6 +57,6 @@ suite with the following command:

All test files live in the spec/_files directory. To create a new test:

* Create a template file `somename.mustache`
* Create a javascript file with data and functions `somename.js`
* Create a file the expected result `somename.txt`
* Create a template file called `somename.mustache`
* Create a JavaScript file containing the view called `somename.js`
* Create a text file with the expected result called `somename.txt`

1 comment on commit e24885c

@paulmillr
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fuck yeah

Please sign in to comment.