Skip to content
Browse files

incremental

  • Loading branch information...
1 parent 51bfc78 commit b4d819064242f04c1127da2ba665ee1bd67e9b8f @malgorithms committed Aug 16, 2012
Showing with 147 additions and 1,806 deletions.
  1. +2 −2 lib/view.js
  2. +19 −18 src/view.coffee
  3. +126 −1,786 test/express3/public/javascripts/test_cases.js
View
4 lib/view.js
@@ -29,7 +29,7 @@
include_bundle_headers: includes some functions needed for browser use
*/
- return "if not toffee? then toffee = {}\nif not toffee.templates then toffee.templates = {}\n\ntoffee.states = " + (JSON.stringify(states)) + "\n\ntoffee.__json = (locals, o) ->\n if not o? then return \"null\"\n else return \"\" + JSON.stringify(o).replace(/</g,'\\\\u003C').replace(/>/g,'\\\\u003E').replace(/&/g,'\\\\u0026')\n\ntoffee.__raw = (locals, o) -> o\n\ntoffee.__html = (locals, o) ->\n (\"\"+o).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;')\n\ntoffee.__escape = (locals, o) ->\n if (not locals.__toffee.autoEscape?) or locals.__toffee.autoEscape\n if o is undefined then return ''\n if o? and (typeof o) is \"object\" then return locals.json o\n return locals.html o\n return o\n\n" + (include_bundle_headers ? getBundleHeaders() : "");
+ return "if not toffee? then toffee = {}\nif not toffee.templates then toffee.templates = {}\n\ntoffee.states = " + (JSON.stringify(states)) + "\n\ntoffee.__json = (locals, o) ->\n if not o? then return \"null\"\n else return \"\" + JSON.stringify(o).replace(/</g,'\\\\u003C').replace(/>/g,'\\\\u003E').replace(/&/g,'\\\\u0026')\n\ntoffee.__raw = (locals, o) -> o\n\ntoffee.__html = (locals, o) ->\n (\"\"+o).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;')\n\ntoffee.__escape = (locals, o) ->\n if (not locals.__toffee.autoEscape?) or locals.__toffee.autoEscape\n if o is undefined then return ''\n if o? and (typeof o) is \"object\" then return locals.json o\n return locals.html o\n return o\n\ntoffee.__augmentLocals = (locals) ->\n _l = locals\n _t = _l.__toffee = { out: []}\n if not _l.print? then _l.print = (o) -> toffee.__print _l, o\n if not _l.json? then _l.json = (o) -> toffee.__json _l, o\n if not _l.raw? then _l.raw = (o) -> toffee.__raw _l, o\n if not _l.html? then _l.html = (o) -> toffee.__html _l, o\n if not _l.escape? then _l.escape = (o) -> toffee.__escape _l, o\n if not _l.partial? then _l.partial = (path, vars) -> toffee.__partial toffee.templates[\"" + this.bundlePath + "\"], _l, path, vars\n if not _l.snippet? then _l.snippet = (path, vars) -> toffee.__snippet toffee.templates[\"" + this.bundlePath + "\"], _l, path, vars\n _t.print = _l.print\n _t.json = _l.json\n _t.raw = _l.raw\n _t.html = _l.html\n _t.escape = _l.escape\n _t.partial = _l.partial\n _t.snippet = _l.snippet\n\n" + (include_bundle_headers ? getBundleHeaders() : "");
};
getBundleHeaders = function() {
@@ -523,7 +523,7 @@
view.prototype._coffeeHeaders = function() {
var ___;
___ = this._tabAsSpaces();
- return "" + (this.browserMode ? '' : getCommonHeaders(false)) + "\ntmpl = toffee.templates[\"" + this.bundlePath + "\"] =\n bundlePath: \"" + this.bundlePath + "\"\ntmpl.pub = (__locals) ->\n" + ___ + "_l = __locals\n" + ___ + "_t = _l.__toffee = { out: []}\n" + ___ + "_to = (x) -> __locals.__toffee.out.push x\n" + ___ + "_ln = (x) -> __locals.__toffee.lineno = x\n" + ___ + "_ts = (x) -> __locals.__toffee.state = x\n\n" + ___ + "if not _l.print? then _l.print = (o) -> toffee.__print _l, o\n" + ___ + "if not _l.json? then _l.json = (o) -> toffee.__json _l, o\n" + ___ + "if not _l.raw? then _l.raw = (o) -> toffee.__raw _l, o\n" + ___ + "if not _l.html? then _l.html = (o) -> toffee.__html _l, o\n" + ___ + "if not _l.escape? then _l.escape = (o) -> toffee.__escape _l, o\n" + ___ + "if not _l.partial? then _l.partial = (path, vars) -> toffee.__partial toffee.templates[\"" + this.bundlePath + "\"], _l, path, vars\n" + ___ + "if not _l.snippet? then _l.snippet = (path, vars) -> toffee.__snippet toffee.templates[\"" + this.bundlePath + "\"], _l, path, vars\n\n" + ___ + "_t.print = _l.print\n" + ___ + "_t.json = _l.json\n" + ___ + "_t.raw = _l.raw\n" + ___ + "_t.html = _l.html\n" + ___ + "_t.escape = _l.escape\n" + ___ + "_t.partial = _l.partial\n" + ___ + "_t.snippet = _l.snippet\n\n" + ___ + "`with (__locals) {`\n" + ___ + "__toffee.out = []";
+ return "" + (this.browserMode ? '' : getCommonHeaders(false)) + "\ntmpl = toffee.templates[\"" + this.bundlePath + "\"] =\n bundlePath: \"" + this.bundlePath + "\"\ntmpl.pub = (__locals) ->\n" + ___ + "_to = (x) -> __locals.__toffee.out.push x\n" + ___ + "_ln = (x) -> __locals.__toffee.lineno = x\n" + ___ + "_ts = (x) -> __locals.__toffee.state = x\n" + ___ + "toffee.__augmentLocals __locals\n\n" + ___ + "`with (__locals) {`\n" + ___ + "__toffee.out = []";
};
view.prototype._coffeeFooters = function() {
View
37 src/view.coffee
@@ -41,6 +41,24 @@ toffee.__escape = (locals, o) ->
return locals.html o
return o
+toffee.__augmentLocals = (locals) ->
+ _l = locals
+ _t = _l.__toffee = { out: []}
+ if not _l.print? then _l.print = (o) -> toffee.__print _l, o
+ if not _l.json? then _l.json = (o) -> toffee.__json _l, o
+ if not _l.raw? then _l.raw = (o) -> toffee.__raw _l, o
+ if not _l.html? then _l.html = (o) -> toffee.__html _l, o
+ if not _l.escape? then _l.escape = (o) -> toffee.__escape _l, o
+ if not _l.partial? then _l.partial = (path, vars) -> toffee.__partial toffee.templates["#{@bundlePath}"], _l, path, vars
+ if not _l.snippet? then _l.snippet = (path, vars) -> toffee.__snippet toffee.templates["#{@bundlePath}"], _l, path, vars
+ _t.print = _l.print
+ _t.json = _l.json
+ _t.raw = _l.raw
+ _t.html = _l.html
+ _t.escape = _l.escape
+ _t.partial = _l.partial
+ _t.snippet = _l.snippet
+
#{if include_bundle_headers then getBundleHeaders() else ""}
"""
@@ -453,27 +471,10 @@ class view
tmpl = toffee.templates["#{@bundlePath}"] =
bundlePath: "#{@bundlePath}"
tmpl.pub = (__locals) ->
-#{___}_l = __locals
-#{___}_t = _l.__toffee = { out: []}
#{___}_to = (x) -> __locals.__toffee.out.push x
#{___}_ln = (x) -> __locals.__toffee.lineno = x
#{___}_ts = (x) -> __locals.__toffee.state = x
-
-#{___}if not _l.print? then _l.print = (o) -> toffee.__print _l, o
-#{___}if not _l.json? then _l.json = (o) -> toffee.__json _l, o
-#{___}if not _l.raw? then _l.raw = (o) -> toffee.__raw _l, o
-#{___}if not _l.html? then _l.html = (o) -> toffee.__html _l, o
-#{___}if not _l.escape? then _l.escape = (o) -> toffee.__escape _l, o
-#{___}if not _l.partial? then _l.partial = (path, vars) -> toffee.__partial toffee.templates["#{@bundlePath}"], _l, path, vars
-#{___}if not _l.snippet? then _l.snippet = (path, vars) -> toffee.__snippet toffee.templates["#{@bundlePath}"], _l, path, vars
-
-#{___}_t.print = _l.print
-#{___}_t.json = _l.json
-#{___}_t.raw = _l.raw
-#{___}_t.html = _l.html
-#{___}_t.escape = _l.escape
-#{___}_t.partial = _l.partial
-#{___}_t.snippet = _l.snippet
+#{___}toffee.__augmentLocals __locals
#{___}`with (__locals) {`
#{___}__toffee.out = []
View
1,912 test/express3/public/javascripts/test_cases.js
126 additions, 1,786 deletions not shown because the diff is too large. Please use a local Git client to view these changes.

0 comments on commit b4d8190

Please sign in to comment.
Something went wrong with that request. Please try again.