Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated examples.

  • Loading branch information...
commit 09ecf4f70c2051c9b0e80d287dc70437b83fc09e 1 parent 5399b60
@mauricemach authored
View
10 Cakefile
@@ -1,15 +1,9 @@
exec = require('child_process').exec
-benchmark = require './benchmark'
-test = require './test'
task 'build', ->
exec 'coffee -c lib/coffeekup.coffee', (err) ->
puts err if err
- exec 'cp lib/coffeekup.js examples/browser', (err) ->
- puts err if err
-task 'test', ->
- test.run()
+task 'test', -> require('./test').run()
-task 'benchmark', ->
- benchmark.run()
+task 'benchmark', -> require('./benchmark').run()
View
8 examples/browser/coffeekup-min.js
@@ -1,8 +0,0 @@
-(function(){var c,l,j,i,m=Object.prototype.hasOwnProperty,o=Array.prototype.slice;i=(l=typeof window!=="undefined"&&window!==null)?window:exports;j=l?typeof CoffeeScript!=="undefined"&&CoffeeScript!==null?CoffeeScript:null:require("coffee-script");c=function(){var a;a=this;this.comment=function(){return c.prototype.comment.apply(a,arguments)};this.doctype=function(){return c.prototype.doctype.apply(a,arguments)};this.tag=function(){return c.prototype.tag.apply(a,arguments)};this.text=function(){return c.prototype.text.apply(a,
-arguments)};return this};c.version="0.1.3";c.doctypes={"5":"<!DOCTYPE html>",xml:'<?xml version="1.0" encoding="utf-8" ?>',"default":'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',transitional:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',strict:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
-frameset:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',"1.1":'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',basic:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',mobile:'<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">'};c.tags="a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|xmp".split("|");
-c.self_closing="area|base|basefont|br|hr|img|input|link|meta".split("|");c.unwrap=function(a){a=String(a);if(a.search(/^(\s)*function/>-1)){a=a.replace(/^(\s)*function(\s)*\(\)(\s)*\{/,"");return a.replace(/\}(\s)*$/,"")}};c.render=function(a,b){var g,e,d,f,h;b=typeof b!=="undefined"&&b!==null?b:{};b.cache=typeof b.cache!=="undefined"&&b.cache!==null?b.cache:false;if((typeof b==="undefined"||b===null?undefined:b.cache)===false||!(typeof(d=this.inst)!=="undefined"&&d!==null)){this.inst=new c;switch(typeof a){case "function":f=
-this.unwrap(a);break;case "string":f=typeof j!=="undefined"&&j!==null?j.compile(String(a),{noWrap:"noWrap"}):this.unwrap(a);break;default:f=""}this.func=Function("locals","with(locals) {"+f+"}")}f=(typeof b==="undefined"||b===null?undefined:b.context)||{};h=(typeof b==="undefined"||b===null?undefined:b.locals)||{};d=f;for(e in d)if(m.call(d,e)){f=d[e];this.inst[e]=f}if(typeof(d=h.body)!=="undefined"&&d!==null){this.inst.body=h.body;delete h.body}h.doctype=this.inst.doctype;h.comment=this.inst.comment;
-h.text=this.inst.text;h.tag=this.inst.tag;h.coffeescript=this.inst.coffeescript;d=this.tags;g=0;for(e=d.length;g<e;g++)(function(){var k=d[g];return h[k]=function(){var n;n=o.call(arguments,0);return this.tag(k,n)}})();e=this.inst.buffer=[];this.func.call(this.inst,h);e[e.length-1]==="\n"&&e.pop();return e.join("")};c.prototype.text=function(a){this.buffer.push(a);return null};c.prototype.tag=function(a,b){var g,e,d,f;this.text("<"+a);d=b;g=0;for(e=d.length;g<e;g++){f=d[g];typeof f==="object"&&this.text(this.render_attrs(f))}if(function(){for(var h=
-0,k=(d=c.self_closing).length;h<k;h++)if(d[h]===a)return true;return false}.call(this))this.text(" />");else{this.text(">");d=b;g=0;for(e=d.length;g<e;g++){f=d[g];switch(typeof f){case "function":f=f.call(this);f==="string"&&this.text(f.toString());break;case "string":this.text(f)}}this.text("</"+a+">")}this.compact||this.text("\n");return null};c.prototype.render_attrs=function(a){var b,g,e;g="";for(b in a)if(m.call(a,b)){e=a[b];g+=" "+b+'="'+e+'"'}return g};c.prototype.doctype=function(a){a=typeof a!==
-"undefined"&&a!==null?a:5;this.text(c.doctypes[a]);if(!this.compact)return this.text("\n")};c.prototype.comment=function(a){return this.text("<!--"+a+"--\>")};c.prototype.coffeescript=function(a){return this.script(function(){return this.text("("+String(a)+")();")})};i.CoffeeKup=c;i.version=c.version;i.render=function(a,b){if(!l)return i.CoffeeKup.render(a,b)}}).call(this);
View
0  examples/browser/coffee-script.js → examples/browser/creme/coffee-script.js
File renamed without changes
View
1  examples/browser/creme/coffeekup.js
View
11 examples/browser/creme.html → examples/browser/creme/index.html
@@ -13,9 +13,9 @@
<script type="text/coffeescript">
stooges = ['moe', 'larry', 'curly']
- $(document).ready ->
+ $().ready ->
stringy = """
- h2 'Crème (string)'
+ h2 'Template as string'
ul ->
for guy in @stooges
@@ -23,19 +23,18 @@
"""
codey = ->
- h2 'Crème (code)'
+ h2 'Template as a function'
ul ->
for guy in @stooges
li guy
$('body').append CoffeeKup.render(stringy, context: {stooges: stooges})
-
$('body').append CoffeeKup.render(codey, context: {stooges: stooges})
</script>
</head>
<body>
- <h1>Client-side CoffeeKup (Crème)</h1>
- <p>Delicious syntax directly on the client-side, but lots of fat from including the CoffeeScript compiler.</p>
+ <h1>Client-side CoffeeKup (crème)</h1>
+ <p>Doing everything on the client. Lots of flexibility but a fatty download.</p>
</body>
</html>
View
26 examples/browser/decaf.html
@@ -1,26 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta charset="utf-8" />
- <title>Client-side CoffeeKup (Decaf)</title>
-
- <!-- jQuery is NOT required, used here for convenience -->
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
-
- <script src="coffeekup.js"></script>
-
- <script>
- $(document).ready(function(){
- var stooges = ['moe', 'larry', 'curly'];
-
- $.get('decaf.js', function(data){
- $('body').append(CoffeeKup.render(data, {context: {stooges: stooges}}));
- });
- });
- </script>
- </head>
- <body>
- <h1>Client-side CoffeeKup (Decaf)</h1>
- <p>Using CoffeeScript in your templates, but not in your app.</p>
- </body>
-</html>
View
10 examples/browser/decaf.js
@@ -1,10 +0,0 @@
-h2('Decaf');
-ul(function() {
- var _i, _len, _ref, _result, guy;
- _result = []; _ref = this.stooges;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- guy = _ref[_i];
- _result.push(li(guy));
- }
- return _result;
-});
View
11 examples/browser/decaf/Cakefile
@@ -0,0 +1,11 @@
+exec = require('child_process').exec
+fs = require 'fs'
+coffekup = require 'coffeekup'
+
+task 'build', ->
+ fs.readFile 'template.coffee', 'utf-8', (err, data) ->
+ puts err if err
+ compiled = coffekup.compile data
+ str = String(compiled).replace 'function anonymous', 'function template'
+ fs.writeFile 'template.js', str, (err) ->
+ puts err if err
View
22 examples/browser/decaf/index.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <title>Client-side CoffeeKup (decaf)</title>
+
+ <!-- jQuery is NOT required, used here for convenience -->
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
+
+ <script src="template.js"></script>
+
+ <script>
+ $().ready(function(){
+ $('body').append(template({context: {stooges: ['moe', 'larry', 'curly']}}));
+ });
+ </script>
+ </head>
+ <body>
+ <h1>Client-side CoffeeKup (decaf)</h1>
+ <p>Consuming a template from a non-CoffeeScript app.</p>
+ </body>
+</html>
View
2  examples/browser/decaf.coffee → examples/browser/decaf/template.coffee
@@ -1,5 +1,3 @@
-h2 'Decaf'
-
ul ->
for guy in @stooges
li guy
View
110 examples/browser/coffeekup.js → examples/browser/decaf/template.js
@@ -1,16 +1,8 @@
-(function() {
- var cache, coffee, coffeekup, skeleton, support, tags;
- var __hasProp = Object.prototype.hasOwnProperty;
- if (typeof window !== "undefined" && window !== null) {
- coffeekup = (window.CoffeeKup = {});
- coffee = (typeof CoffeeScript !== "undefined" && CoffeeScript !== null) ? CoffeeScript : null;
- } else {
- coffeekup = exports;
- coffee = require('coffee-script');
- }
- coffeekup.version = '0.1.7';
- skeleton = function(ck_options) {
- var ck_buffer, ck_doctypes, ck_esc, ck_indent, ck_render_attrs, ck_repeat, ck_self_closing, ck_tabs, ck_tag, coffeescript, comment, doctype, h, tag, text;
+function template(ck_options) {
+var __slice = Array.prototype.slice;
+var __hasProp = Object.prototype.hasOwnProperty;
+var __bind = function(func, context) {return function(){ return func.apply(context, arguments); };};
+ var ck_buffer, ck_doctypes, ck_esc, ck_indent, ck_render_attrs, ck_repeat, ck_self_closing, ck_tabs, ck_tag, coffeescript, comment, doctype, h, tag, text, a,i,li,p,s,th,u,ul;
ck_options = (typeof ck_options !== "undefined" && ck_options !== null) ? ck_options : {};
ck_options.context = (typeof ck_options.context !== "undefined" && ck_options.context !== null) ? ck_options.context : {};
ck_options.locals = (typeof ck_options.locals !== "undefined" && ck_options.locals !== null) ? ck_options.locals : {};
@@ -132,87 +124,13 @@
coffeescript = function(code) {
return script(";(" + (code) + ")();");
};
- return null;
- };
- support = 'var __slice = Array.prototype.slice;\nvar __hasProp = Object.prototype.hasOwnProperty;\nvar __bind = function(func, context) {return function(){ return func.apply(context, arguments); };};';
- skeleton = String(skeleton).replace('function (ck_options) {', '').replace(/return null;\s*\}$/, '');
- skeleton = support + skeleton;
- tags = 'a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|u|ul|video|xmp'.split('|');
- coffeekup.compile = function(template, options) {
- var _i, _len, _ref, code, k, t, tags_here, v;
- options = (typeof options !== "undefined" && options !== null) ? options : {};
- options.locals = (typeof options.locals !== "undefined" && options.locals !== null) ? options.locals : {};
- if (typeof template === 'function') {
- template = String(template);
- } else if (typeof template === 'string' && (typeof coffee !== "undefined" && coffee !== null)) {
- template = coffee.compile(template, {
- 'noWrap': 'noWrap'
- });
- template = ("function(){" + (template) + "}");
- }
- tags_here = [];
- _ref = tags;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- t = _ref[_i];
- if (template.indexOf(t) > -1) {
- tags_here.push(t);
- }
- }
- code = skeleton.replace(', text;', ", text, " + (tags_here.join(',')) + ";");
- code += 'var arrayCreator = Array;';
- _ref = tags_here;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- t = _ref[_i];
- code += ("" + (t) + " = function(){return ck_tag('" + (t) + "', arguments)};");
- }
- _ref = options.locals;
- for (k in _ref) {
- if (!__hasProp.call(_ref, k)) continue;
- v = _ref[k];
- if (typeof v === 'function') {
- code += ("var " + (k) + " = " + (v) + ";");
- } else {
- code += ("var " + (k) + " = " + (JSON.stringify(v)) + ";");
- }
- }
- if (options.dynamic_locals) {
- code += 'with(ck_options.locals){';
- }
- code += ("(" + (template) + ").call(ck_options.context);");
- if (options.dynamic_locals) {
- code += '}';
- }
- code += "return ck_buffer.join('');";
- return new Function('ck_options', code);
- };
- cache = {};
- coffeekup.render = function(template, options) {
- var _ref, tpl;
- options = (typeof options !== "undefined" && options !== null) ? options : {};
- options.context = (typeof options.context !== "undefined" && options.context !== null) ? options.context : {};
- options.locals = (typeof options.locals !== "undefined" && options.locals !== null) ? options.locals : {};
- options.cache = (typeof options.cache !== "undefined" && options.cache !== null) ? options.cache : true;
- if (typeof (_ref = options.locals.body) !== "undefined" && _ref !== null) {
- options.context.body = options.locals.body;
- delete options.locals.body;
- }
- if (options.cache && (typeof (_ref = cache[template]) !== "undefined" && _ref !== null)) {
- tpl = cache[template];
- } else if (options.cache) {
- tpl = (cache[template] = coffeekup.compile(template, options));
- } else {
- tpl = coffeekup.compile(template, options);
- }
- return tpl(options);
- };
- if (!(typeof window !== "undefined" && window !== null)) {
- coffeekup.adapters = {
- simple: function(template, data) {
- return coffeekup.render(template, {
- context: data
- });
- }
- };
- coffeekup.adapters.meryl = coffeekup.adapters.simple;
+ var arrayCreator = Array;a = function(){return ck_tag('a', arguments)};i = function(){return ck_tag('i', arguments)};li = function(){return ck_tag('li', arguments)};p = function(){return ck_tag('p', arguments)};s = function(){return ck_tag('s', arguments)};th = function(){return ck_tag('th', arguments)};u = function(){return ck_tag('u', arguments)};ul = function(){return ck_tag('ul', arguments)};(function(){ul(function() {
+ var _i, _len, _ref, _result, guy;
+ _result = []; _ref = this.stooges;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ guy = _ref[_i];
+ _result.push(li(guy));
}
-}).call(this);
+ return _result;
+});}).call(ck_options.context);return ck_buffer.join('');
+}
View
11 examples/browser/regular.coffee
@@ -1,11 +0,0 @@
-stooges = ['moe', 'larry', 'curly']
-
-$(document).ready ->
- codey = ->
- h2 'Regular'
-
- ul ->
- for guy in @stooges
- li guy
-
- $('body').append CoffeeKup.render(codey, context: {stooges: stooges})
View
17 examples/browser/regular.html
@@ -1,17 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta charset="utf-8" />
- <title>Client-side CoffeeKup (Regular)</title>
-
- <!-- jQuery is NOT required, used here for convenience -->
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
-
- <script src="coffeekup.js"></script>
- <script src="regular.js"></script>
- </head>
- <body>
- <h1>Client-side CoffeeKup (Regular)</h1>
- <p>Using CoffeeScript but on the server-side, thus avoiding the fatty compiler here.</p>
- </body>
-</html>
View
22 examples/browser/regular.js
@@ -1,22 +0,0 @@
-var stooges;
-stooges = ['moe', 'larry', 'curly'];
-$(document).ready(function() {
- var codey;
- codey = function() {
- h2('Regular');
- return ul(function() {
- var _i, _len, _ref, _result, guy;
- _result = []; _ref = this.stooges;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- guy = _ref[_i];
- _result.push(li(guy));
- }
- return _result;
- });
- };
- return $('body').append(CoffeeKup.render(codey, {
- context: {
- stooges: stooges
- }
- }));
-});
View
13 examples/browser/regular/Cakefile
@@ -0,0 +1,13 @@
+exec = require('child_process').exec
+fs = require 'fs'
+coffekup = require 'coffeekup'
+
+task 'build', ->
+ fs.readFile 'template.coffee', 'utf-8', (err, data) ->
+ puts err if err
+ compiled = coffekup.compile data
+ str = String(compiled).replace 'function anonymous', 'function template'
+ fs.writeFile 'template.js', str, (err) ->
+ puts err if err
+ exec 'coffee -c index.coffee', (err) ->
+ puts err if err
View
2  examples/browser/regular/index.coffee
@@ -0,0 +1,2 @@
+$().ready ->
+ $('body').append template(context: {stooges: ['moe', 'larry', 'curly']})
View
17 examples/browser/regular/index.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <title>Client-side CoffeeKup (regular)</title>
+
+ <!-- jQuery is NOT required, used here for convenience -->
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
+
+ <script src="template.js"></script>
+ <script src="index.js"></script>
+ </head>
+ <body>
+ <h1>Client-side CoffeeKup (regular)</h1>
+ <p>Writing your app and templates in CoffeeScript but pre-compiling everything on the server-side.</p>
+ </body>
+</html>
View
9 examples/browser/regular/index.js
@@ -0,0 +1,9 @@
+(function() {
+ $().ready(function() {
+ return $('body').append(template({
+ context: {
+ stooges: ['moe', 'larry', 'curly']
+ }
+ }));
+ });
+}).call(this);
View
3  examples/browser/regular/template.coffee
@@ -0,0 +1,3 @@
+ul ->
+ for guy in @stooges
+ li guy
View
136 examples/browser/regular/template.js
@@ -0,0 +1,136 @@
+function template(ck_options) {
+var __slice = Array.prototype.slice;
+var __hasProp = Object.prototype.hasOwnProperty;
+var __bind = function(func, context) {return function(){ return func.apply(context, arguments); };};
+ var ck_buffer, ck_doctypes, ck_esc, ck_indent, ck_render_attrs, ck_repeat, ck_self_closing, ck_tabs, ck_tag, coffeescript, comment, doctype, h, tag, text, a,i,li,p,s,th,u,ul;
+ ck_options = (typeof ck_options !== "undefined" && ck_options !== null) ? ck_options : {};
+ ck_options.context = (typeof ck_options.context !== "undefined" && ck_options.context !== null) ? ck_options.context : {};
+ ck_options.locals = (typeof ck_options.locals !== "undefined" && ck_options.locals !== null) ? ck_options.locals : {};
+ ck_options.format = (typeof ck_options.format !== "undefined" && ck_options.format !== null) ? ck_options.format : false;
+ ck_options.autoescape = (typeof ck_options.autoescape !== "undefined" && ck_options.autoescape !== null) ? ck_options.autoescape : false;
+ ck_buffer = [];
+ ck_render_attrs = function(obj) {
+ var _ref, k, str, v;
+ str = '';
+ _ref = obj;
+ for (k in _ref) {
+ if (!__hasProp.call(_ref, k)) continue;
+ v = _ref[k];
+ str += (" " + (k) + "=\"" + (ck_esc(v)) + "\"");
+ }
+ return str;
+ };
+ ck_doctypes = {
+ '5': '<!DOCTYPE html>',
+ 'xml': '<?xml version="1.0" encoding="utf-8" ?>',
+ 'default': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
+ 'transitional': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
+ 'strict': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
+ 'frameset': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
+ '1.1': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
+ 'basic': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
+ 'mobile': '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">'
+ };
+ ck_self_closing = ['area', 'base', 'basefont', 'br', 'hr', 'img', 'input', 'link', 'meta'];
+ ck_esc = function(txt) {
+ return ck_options.autoescape ? h(txt) : String(txt);
+ };
+ ck_tabs = 0;
+ ck_repeat = function(string, count) {
+ return Array(count + 1).join(string);
+ };
+ ck_indent = function() {
+ if (ck_options.format) {
+ return text(ck_repeat(' ', ck_tabs));
+ }
+ };
+ h = function(txt) {
+ return String(txt).replace(/&(?!\w+;)/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
+ };
+ doctype = function(type) {
+ type = (typeof type !== "undefined" && type !== null) ? type : 5;
+ text(ck_doctypes[type]);
+ if (ck_options.format) {
+ return text('\n');
+ }
+ };
+ text = function(txt) {
+ ck_buffer.push(String(txt));
+ return null;
+ };
+ comment = function(cmt) {
+ text("<!--" + (cmt) + "-->");
+ if (ck_options.format) {
+ return text('\n');
+ }
+ };
+ tag = function() {
+ var name;
+ name = arguments[0];
+ delete arguments[0];
+ return ck_tag(name, arguments);
+ };
+ ck_tag = function(name, opts) {
+ var _i, _len, _ref, o, result;
+ ck_indent();
+ text("<" + (name));
+ _ref = opts;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ o = _ref[_i];
+ if (typeof o === 'object') {
+ text(ck_render_attrs(o));
+ }
+ }
+ if ((function(){ for (var _i=0, _len=ck_self_closing.length; _i<_len; _i++) { if (ck_self_closing[_i] === name) return true; } return false; }).call(this)) {
+ text(' />');
+ if (ck_options.format) {
+ text('\n');
+ }
+ } else {
+ text('>');
+ _ref = opts;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ o = _ref[_i];
+ switch (typeof o) {
+ case 'string':
+ case 'number':
+ text(ck_esc(o));
+ break;
+ case 'function':
+ if (ck_options.format) {
+ text('\n');
+ }
+ ck_tabs++;
+ result = o.call(ck_options.context);
+ if (typeof result === 'string') {
+ ck_indent();
+ text(ck_esc(result));
+ if (ck_options.format) {
+ text('\n');
+ }
+ }
+ ck_tabs--;
+ ck_indent();
+ break;
+ }
+ }
+ text("</" + (name) + ">");
+ if (ck_options.format) {
+ text('\n');
+ }
+ }
+ return null;
+ };
+ coffeescript = function(code) {
+ return script(";(" + (code) + ")();");
+ };
+ var arrayCreator = Array;a = function(){return ck_tag('a', arguments)};i = function(){return ck_tag('i', arguments)};li = function(){return ck_tag('li', arguments)};p = function(){return ck_tag('p', arguments)};s = function(){return ck_tag('s', arguments)};th = function(){return ck_tag('th', arguments)};u = function(){return ck_tag('u', arguments)};ul = function(){return ck_tag('ul', arguments)};(function(){ul(function() {
+ var _i, _len, _ref, _result, guy;
+ _result = []; _ref = this.stooges;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ guy = _ref[_i];
+ _result.push(li(guy));
+ }
+ return _result;
+});}).call(ck_options.context);return ck_buffer.join('');
+}
View
4 examples/express/app.coffee
@@ -13,4 +13,6 @@ app.get '/inline', (req, res) ->
res.send require('coffeekup').render ->
h1 'This is an inline template.'
-app.listen 8000
+app.listen 3000
+
+puts "Listening on 3000..."
View
2  examples/meryl/app.coffee
@@ -9,3 +9,5 @@ meryl.run
templateDir: 'templates'
templateExt: '.coffee'
templateFunc: coffeekup.adapters.meryl
+
+puts 'Listening on 3000...'
Please sign in to comment.
Something went wrong with that request. Please try again.