snowball 0.1.21 → 0.1.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.gitignore +1 -3
- data/{lib/snowball → bin}/roll.js +0 -0
- data/lib/snowball/roller.rb +1 -1
- data/lib/snowball/version.rb +1 -1
- data/node_modules/.bin/browserify +161 -0
- data/node_modules/.bin/cake +7 -0
- data/node_modules/.bin/coffee +7 -0
- data/node_modules/.bin/jade +168 -0
- data/node_modules/browserify/.travis.yml +4 -0
- data/node_modules/browserify/LICENSE +63 -0
- data/node_modules/browserify/README.markdown +172 -0
- data/node_modules/browserify/bin/cmd.js +161 -0
- data/node_modules/browserify/builtins/__browserify_process.js +55 -0
- data/node_modules/browserify/builtins/assert.js +314 -0
- data/node_modules/browserify/builtins/child_process.js +2 -0
- data/node_modules/browserify/builtins/events.js +178 -0
- data/node_modules/browserify/builtins/fs.js +1 -0
- data/node_modules/browserify/builtins/https.js +1 -0
- data/node_modules/browserify/builtins/net.js +1 -0
- data/node_modules/browserify/builtins/path.js +175 -0
- data/node_modules/browserify/builtins/querystring.js +250 -0
- data/node_modules/browserify/builtins/stream.js +119 -0
- data/node_modules/browserify/builtins/string_decoder.js +161 -0
- data/node_modules/browserify/builtins/sys.js +1 -0
- data/node_modules/browserify/builtins/timers.js +39 -0
- data/node_modules/browserify/builtins/tls.js +1 -0
- data/node_modules/browserify/builtins/tty.js +2 -0
- data/node_modules/browserify/builtins/url.js +604 -0
- data/node_modules/browserify/builtins/util.js +351 -0
- data/node_modules/browserify/example/debug/browserify.js +219 -0
- data/node_modules/browserify/example/debug/build.sh +3 -0
- data/node_modules/browserify/example/debug/index.html +7 -0
- data/node_modules/browserify/example/debug/js/entry.js +2 -0
- data/node_modules/browserify/example/debug/js/thrower.js +3 -0
- data/node_modules/browserify/example/debug/server.js +9 -0
- data/node_modules/browserify/example/simple-build/browserify.js +368 -0
- data/node_modules/browserify/example/simple-build/build.sh +3 -0
- data/node_modules/browserify/example/simple-build/index.html +9 -0
- data/node_modules/browserify/example/simple-build/js/bar.js +3 -0
- data/node_modules/browserify/example/simple-build/js/entry.js +5 -0
- data/node_modules/browserify/example/simple-build/js/foo.js +5 -0
- data/node_modules/browserify/example/simple-build/server.js +9 -0
- data/node_modules/browserify/example/test/b.js +5 -0
- data/node_modules/browserify/example/test/bar.js +3 -0
- data/node_modules/browserify/example/test/foo.js +3 -0
- data/node_modules/browserify/example/test/m.js +3 -0
- data/node_modules/browserify/example/test/n.js +3 -0
- data/node_modules/browserify/example/using-http/bundle.js +813 -0
- data/node_modules/browserify/example/using-http/entry.js +25 -0
- data/node_modules/browserify/example/using-http/index.html +9 -0
- data/node_modules/browserify/example/using-http/server.js +28 -0
- data/node_modules/browserify/index.js +202 -0
- data/node_modules/browserify/lib/watch.js +75 -0
- data/node_modules/browserify/lib/wrap.js +580 -0
- data/node_modules/browserify/lib/wrappers.js +10 -0
- data/node_modules/browserify/node_modules/buffer-browserify/.npmignore +1 -0
- data/node_modules/browserify/node_modules/buffer-browserify/README.md +11 -0
- data/node_modules/browserify/node_modules/buffer-browserify/buffer_ieee754.js +84 -0
- data/node_modules/browserify/node_modules/buffer-browserify/index.js +1317 -0
- data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/README.md +14 -0
- data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/lib/b64.js +84 -0
- data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/package.json +30 -0
- data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/test/runner.js +50 -0
- data/node_modules/browserify/node_modules/buffer-browserify/package.json +46 -0
- data/node_modules/browserify/node_modules/buffer-browserify/test/buffer.js +218 -0
- data/node_modules/browserify/node_modules/commondir/README.markdown +45 -0
- data/node_modules/browserify/node_modules/commondir/example/base.js +3 -0
- data/node_modules/browserify/node_modules/commondir/example/dir.js +3 -0
- data/node_modules/browserify/node_modules/commondir/index.js +29 -0
- data/node_modules/browserify/node_modules/commondir/package.json +47 -0
- data/node_modules/browserify/node_modules/commondir/test/dirs.js +66 -0
- data/node_modules/browserify/node_modules/crypto-browserify/.travis.yml +4 -0
- data/node_modules/browserify/node_modules/crypto-browserify/example/bundle.js +637 -0
- data/node_modules/browserify/node_modules/crypto-browserify/example/index.html +12 -0
- data/node_modules/browserify/node_modules/crypto-browserify/example/test.js +4 -0
- data/node_modules/browserify/node_modules/crypto-browserify/index.js +74 -0
- data/node_modules/browserify/node_modules/crypto-browserify/md5.js +384 -0
- data/node_modules/browserify/node_modules/crypto-browserify/package.json +33 -0
- data/node_modules/browserify/node_modules/crypto-browserify/readme.markdown +20 -0
- data/node_modules/browserify/node_modules/crypto-browserify/rng.js +37 -0
- data/node_modules/browserify/node_modules/crypto-browserify/sha.js +210 -0
- data/node_modules/browserify/node_modules/crypto-browserify/test/simple.js +35 -0
- data/node_modules/browserify/node_modules/deputy/.travis.yml +4 -0
- data/node_modules/browserify/node_modules/deputy/README.markdown +55 -0
- data/node_modules/browserify/node_modules/deputy/example/cache.js +5 -0
- data/node_modules/browserify/node_modules/deputy/index.js +46 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/.npmignore +2 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/.travis.yml +5 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/LICENSE +21 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/examples/pow.js +6 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/index.js +82 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/package.json +34 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/readme.markdown +63 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/chmod.js +38 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/clobber.js +37 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/mkdirp.js +28 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/perm.js +32 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/perm_sync.js +39 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/race.js +41 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/rel.js +32 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/return.js +25 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/return_sync.js +24 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/root.js +18 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/sync.js +32 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/umask.js +28 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/umask_sync.js +32 -0
- data/node_modules/browserify/node_modules/deputy/package.json +47 -0
- data/node_modules/browserify/node_modules/deputy/test/cache.js +58 -0
- data/node_modules/browserify/node_modules/detective/.travis.yml +4 -0
- data/node_modules/browserify/node_modules/detective/README.markdown +66 -0
- data/node_modules/browserify/node_modules/detective/example/strings.js +6 -0
- data/node_modules/browserify/node_modules/detective/example/strings_src.js +3 -0
- data/node_modules/browserify/node_modules/detective/index.js +60 -0
- data/node_modules/browserify/node_modules/detective/node_modules/.bin/esparse +42 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/.travis.yml +5 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/LICENSE.BSD +19 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/README.md +74 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/codemirror/codemirror.css +112 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/codemirror/codemirror.js +2972 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/codemirror/javascript.js +360 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/json2.js +487 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/style.css +164 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/treeview-min.js +12 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/treeview-sprite.gif +0 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/treeview.css +7 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/yahoo-dom-event.js +14 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/bin/esparse.js +42 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/changes +92 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/cm +696 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/checkenv.js +42 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/collector.html +82 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/collector.js +170 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/functiontrace.html +106 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/functiontrace.js +123 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/parse.css +82 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/parse.html +352 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/precedence.html +225 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/rewrite.html +120 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/rewrite.js +71 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/esprima.js +3577 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/index.html +103 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/package.json +42 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/Tokenizer.js +646 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/XMLHttpRequest.js +509 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/ZeParser.js +2185 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/backbone-0.5.3.js +1158 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/benchmark.js +3261 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/escodegen.js +906 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/esmorph.js +240 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/ext-core-3.0.0.js +6579 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/ext-core-3.1.0.js +10255 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jquery-1.6.4.js +9046 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jquery-1.7.1.js +9266 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jquery.mobile-1.0.js +6951 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jsdefs.js +731 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jslex.js +588 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jsparse.js +1921 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/mootools-1.3.2.js +5952 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/mootools-1.4.1.js +6297 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/parse-js.js +1342 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/platform.js +878 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/prototype-1.6.1.js +4874 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/prototype-1.7.0.0.js +6082 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/underscore-1.2.3.js +981 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/benchmarks.html +58 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/benchmarks.js +328 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compare.html +140 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compare.js +270 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compat.html +40 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compat.js +239 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/coverage.footer.html +3 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/coverage.header.html +37 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/coverage.html +3617 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/index.html +36 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/reflect.js +403 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/run.js +66 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/test.js +16659 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/tools/generate-unicode-regex.py +164 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/tools/update-coverage.sh +28 -0
- data/node_modules/browserify/node_modules/detective/package.json +47 -0
- data/node_modules/browserify/node_modules/detective/test/both.js +11 -0
- data/node_modules/browserify/node_modules/detective/test/chained.js +9 -0
- data/node_modules/browserify/node_modules/detective/test/files/both.js +4 -0
- data/node_modules/browserify/node_modules/detective/test/files/chained.js +5 -0
- data/node_modules/browserify/node_modules/detective/test/files/nested.js +22 -0
- data/node_modules/browserify/node_modules/detective/test/files/skip.js +7 -0
- data/node_modules/browserify/node_modules/detective/test/files/strings.js +13 -0
- data/node_modules/browserify/node_modules/detective/test/files/word.js +13 -0
- data/node_modules/browserify/node_modules/detective/test/nested.js +9 -0
- data/node_modules/browserify/node_modules/detective/test/skip.js +9 -0
- data/node_modules/browserify/node_modules/detective/test/strings.js +9 -0
- data/node_modules/browserify/node_modules/detective/test/word.js +12 -0
- data/node_modules/browserify/node_modules/http-browserify/.npmignore +1 -0
- data/node_modules/browserify/node_modules/http-browserify/example/get/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/get/main.js +14 -0
- data/node_modules/browserify/node_modules/http-browserify/example/get/server.js +12 -0
- data/node_modules/browserify/node_modules/http-browserify/example/headers/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/headers/main.js +18 -0
- data/node_modules/browserify/node_modules/http-browserify/example/headers/server.js +15 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/data.json +139 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/main.js +13 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/.npmignore +2 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/.travis.yml +4 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/LICENSE.APACHE2 +15 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/LICENSE.MIT +24 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/examples/all_docs.js +13 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/index.js +189 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/LICENSE +24 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/README.markdown +11 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/bench.js +26 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/examples/twitterfeed.js +30 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/jsonparse.js +379 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/package.json +36 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/samplejson/basic.json +167 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/samplejson/basic2.json +180 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/test/primitives.js +54 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/test/utf8.js +38 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/package.json +40 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/readme.markdown +145 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/bool.js +41 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/destroy_missing.js +22 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/empty.js +44 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/fixtures/all_npm.json +4030 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/fn.js +39 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/memory.js +69 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/multiple_objects.js +42 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/multiple_objects_error.js +35 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/parsejson.js +28 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/stringify.js +41 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/stringify_object.js +47 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/test.js +35 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/test2.js +29 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/two-ways.js +41 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/server.js +10 -0
- data/node_modules/browserify/node_modules/http-browserify/example/post/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/post/main.js +16 -0
- data/node_modules/browserify/node_modules/http-browserify/example/post/server.js +19 -0
- data/node_modules/browserify/node_modules/http-browserify/example/streaming/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/streaming/main.js +16 -0
- data/node_modules/browserify/node_modules/http-browserify/example/streaming/server.js +21 -0
- data/node_modules/browserify/node_modules/http-browserify/index.js +59 -0
- data/node_modules/browserify/node_modules/http-browserify/lib/request.js +128 -0
- data/node_modules/browserify/node_modules/http-browserify/lib/response.js +119 -0
- data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/index.js +48 -0
- data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/package.json +30 -0
- data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/readme.md +31 -0
- data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/test.js +34 -0
- data/node_modules/browserify/node_modules/http-browserify/package.json +46 -0
- data/node_modules/browserify/node_modules/http-browserify/readme.markdown +128 -0
- data/node_modules/browserify/node_modules/nub/README.markdown +23 -0
- data/node_modules/browserify/node_modules/nub/index.js +64 -0
- data/node_modules/browserify/node_modules/nub/package.json +46 -0
- data/node_modules/browserify/node_modules/nub/test/by.js +51 -0
- data/node_modules/browserify/node_modules/nub/test/nub.js +46 -0
- data/node_modules/browserify/node_modules/resolve/.travis.yml +4 -0
- data/node_modules/browserify/node_modules/resolve/LICENSE +18 -0
- data/node_modules/browserify/node_modules/resolve/README.markdown +47 -0
- data/node_modules/browserify/node_modules/resolve/index.js +106 -0
- data/node_modules/browserify/node_modules/resolve/package.json +45 -0
- data/node_modules/browserify/node_modules/resolve/test/core.js +12 -0
- data/node_modules/browserify/node_modules/resolve/test/filter.js +15 -0
- data/node_modules/browserify/node_modules/resolve/test/mock.js +64 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver.js +157 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/bar/node_modules/foo/index.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/baz/doom.js +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/baz/package.json +3 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/baz/quux.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/biz/node_modules/grux/index.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/biz/node_modules/tiv/index.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/cup.coffee +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/foo.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/mug.coffee +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/mug.js +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/other_path/lib/other-lib.js +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/other_path/root.js +0 -0
- data/node_modules/browserify/node_modules/syntax-error/.travis.yml +4 -0
- data/node_modules/browserify/node_modules/syntax-error/LICENSE +18 -0
- data/node_modules/browserify/node_modules/syntax-error/example/check.js +12 -0
- data/node_modules/browserify/node_modules/syntax-error/example/src.js +9 -0
- data/node_modules/browserify/node_modules/syntax-error/index.js +54 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/.bin/esparse +42 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/.travis.yml +5 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/LICENSE.BSD +19 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/README.md +74 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/codemirror/codemirror.css +112 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/codemirror/codemirror.js +2972 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/codemirror/javascript.js +360 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/json2.js +487 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/style.css +164 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/treeview-min.js +12 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/treeview-sprite.gif +0 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/treeview.css +7 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/yahoo-dom-event.js +14 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/bin/esparse.js +42 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/changes +92 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/cm +696 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/checkenv.js +42 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/collector.html +82 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/collector.js +170 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/functiontrace.html +106 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/functiontrace.js +123 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/parse.css +82 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/parse.html +352 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/precedence.html +225 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/rewrite.html +120 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/rewrite.js +71 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/esprima.js +3577 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/index.html +103 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/package.json +42 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/Tokenizer.js +646 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/XMLHttpRequest.js +509 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/ZeParser.js +2185 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/backbone-0.5.3.js +1158 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/benchmark.js +3261 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/escodegen.js +906 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/esmorph.js +240 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/ext-core-3.0.0.js +6579 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/ext-core-3.1.0.js +10255 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jquery-1.6.4.js +9046 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jquery-1.7.1.js +9266 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jquery.mobile-1.0.js +6951 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jsdefs.js +731 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jslex.js +588 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jsparse.js +1921 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/mootools-1.3.2.js +5952 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/mootools-1.4.1.js +6297 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/parse-js.js +1342 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/platform.js +878 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/prototype-1.6.1.js +4874 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/prototype-1.7.0.0.js +6082 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/underscore-1.2.3.js +981 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/benchmarks.html +58 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/benchmarks.js +328 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compare.html +140 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compare.js +270 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compat.html +40 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compat.js +239 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/coverage.footer.html +3 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/coverage.header.html +37 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/coverage.html +3617 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/index.html +36 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/reflect.js +403 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/run.js +66 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/test.js +16659 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/tools/generate-unicode-regex.py +164 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/tools/update-coverage.sh +28 -0
- data/node_modules/browserify/node_modules/syntax-error/package.json +49 -0
- data/node_modules/browserify/node_modules/syntax-error/readme.markdown +87 -0
- data/node_modules/browserify/node_modules/syntax-error/test/check.js +17 -0
- data/node_modules/browserify/node_modules/syntax-error/test/sources/check.js +9 -0
- data/node_modules/browserify/node_modules/vm-browserify/README.markdown +103 -0
- data/node_modules/browserify/node_modules/vm-browserify/example/run/bundle.js +473 -0
- data/node_modules/browserify/node_modules/vm-browserify/example/run/entry.js +6 -0
- data/node_modules/browserify/node_modules/vm-browserify/example/run/index.html +9 -0
- data/node_modules/browserify/node_modules/vm-browserify/example/run/server.js +6 -0
- data/node_modules/browserify/node_modules/vm-browserify/index.js +85 -0
- data/node_modules/browserify/node_modules/vm-browserify/package.json +43 -0
- data/node_modules/browserify/node_modules/vm-browserify/testling/run.js +22 -0
- data/node_modules/browserify/node_modules/vm-browserify/testling/test.sh +11 -0
- data/node_modules/browserify/package.json +78 -0
- data/node_modules/browserify/test/alias.js +58 -0
- data/node_modules/browserify/test/backbone.js +21 -0
- data/node_modules/browserify/test/bin.js +39 -0
- data/node_modules/browserify/test/buffer.js +99 -0
- data/node_modules/browserify/test/bundle.js +32 -0
- data/node_modules/browserify/test/cache.js +28 -0
- data/node_modules/browserify/test/coffee.js +39 -0
- data/node_modules/browserify/test/coffee/bar.js +1 -0
- data/node_modules/browserify/test/coffee/baz.coffee +1 -0
- data/node_modules/browserify/test/coffee/entry.coffee +1 -0
- data/node_modules/browserify/test/coffee/foo.coffee +1 -0
- data/node_modules/browserify/test/coffee/index.coffee +5 -0
- data/node_modules/browserify/test/coffee/nested/nested.coffee +2 -0
- data/node_modules/browserify/test/comment.js +17 -0
- data/node_modules/browserify/test/comment/main.js +2 -0
- data/node_modules/browserify/test/crypto.js +37 -0
- data/node_modules/browserify/test/dnode.js +27 -0
- data/node_modules/browserify/test/dollar.js +19 -0
- data/node_modules/browserify/test/dollar/dollar/index.js +7 -0
- data/node_modules/browserify/test/entry.js +36 -0
- data/node_modules/browserify/test/entry/main.js +1 -0
- data/node_modules/browserify/test/entry/one.js +1 -0
- data/node_modules/browserify/test/entry/two.js +1 -0
- data/node_modules/browserify/test/error_code.js +24 -0
- data/node_modules/browserify/test/error_code/src.js +2 -0
- data/node_modules/browserify/test/export.js +52 -0
- data/node_modules/browserify/test/export/entry.js +1 -0
- data/node_modules/browserify/test/field.js +64 -0
- data/node_modules/browserify/test/field/miss.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-miss/browser.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-miss/main.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-miss/package.json +4 -0
- data/node_modules/browserify/test/field/node_modules/z-object/browser.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-object/main.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-object/package.json +6 -0
- data/node_modules/browserify/test/field/node_modules/z-string/browser.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-string/main.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-string/package.json +4 -0
- data/node_modules/browserify/test/field/node_modules/z-sub/browser/a.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-sub/browser/b.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-sub/main.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-sub/package.json +4 -0
- data/node_modules/browserify/test/field/object.js +1 -0
- data/node_modules/browserify/test/field/string.js +1 -0
- data/node_modules/browserify/test/field/sub.js +1 -0
- data/node_modules/browserify/test/global.js +19 -0
- data/node_modules/browserify/test/global/main.js +2 -0
- data/node_modules/browserify/test/jade.js +35 -0
- data/node_modules/browserify/test/json.js +17 -0
- data/node_modules/browserify/test/json/beep.json +4 -0
- data/node_modules/browserify/test/json/main.js +1 -0
- data/node_modules/browserify/test/maxlisteners.js +8 -0
- data/node_modules/browserify/test/module.js +22 -0
- data/node_modules/browserify/test/multi_entry.js +20 -0
- data/node_modules/browserify/test/multi_entry/a.js +2 -0
- data/node_modules/browserify/test/multi_entry/b.js +2 -0
- data/node_modules/browserify/test/multi_entry/c.js +3 -0
- data/node_modules/browserify/test/multi_ignore.js +23 -0
- data/node_modules/browserify/test/node_modules/beep/index.js +1 -0
- data/node_modules/browserify/test/require_cache.js +18 -0
- data/node_modules/browserify/test/retarget.js +27 -0
- data/node_modules/browserify/test/seq.js +47 -0
- data/node_modules/browserify/test/subdep.js +26 -0
- data/node_modules/browserify/test/subdep/index.js +1 -0
- data/node_modules/browserify/test/subdep/package.json +6 -0
- data/node_modules/browserify/test/util.js +48 -0
- data/node_modules/browserify/test/watch.js +91 -0
- data/node_modules/browserify/test/watch/a.js +1 -0
- data/node_modules/browserify/test/wrap.js +43 -0
- data/node_modules/browserify/test/wrap/a.js +2 -0
- data/node_modules/browserify/test/wrap/c.js +1 -0
- data/node_modules/browserify/test/wrap/node_modules/b/main.js +1 -0
- data/node_modules/browserify/test/wrap/node_modules/b/package.json +3 -0
- data/node_modules/browserify/test/wrap/node_modules/skipmetoo/index.js +1 -0
- data/node_modules/browserify/test/wrap/skipme.js +1 -0
- data/node_modules/browserify/test/wrap/x.js +0 -0
- data/node_modules/browserify/testling/README.markdown +29 -0
- data/node_modules/browserify/testling/test.sh +37 -0
- data/node_modules/browserify/testling/tick.js +9 -0
- data/node_modules/browserify/testling/timers.js +50 -0
- data/node_modules/browserify/testling/util.js +24 -0
- data/node_modules/browserify/v2.markdown +41 -0
- data/node_modules/browserify/wrappers/alias.js +1 -0
- data/node_modules/browserify/wrappers/body.js +2 -0
- data/node_modules/browserify/wrappers/body_debug.js +2 -0
- data/node_modules/browserify/wrappers/entry.js +3 -0
- data/node_modules/browserify/wrappers/entry_debug.js +3 -0
- data/node_modules/browserify/wrappers/package.js +3 -0
- data/node_modules/browserify/wrappers/prelude.js +196 -0
- data/node_modules/coffee-script/.npmignore +11 -0
- data/node_modules/coffee-script/CNAME +1 -0
- data/node_modules/coffee-script/CONTRIBUTING.md +9 -0
- data/node_modules/coffee-script/LICENSE +22 -0
- data/node_modules/coffee-script/README +51 -0
- data/node_modules/coffee-script/Rakefile +78 -0
- data/node_modules/coffee-script/bin/cake +7 -0
- data/node_modules/coffee-script/bin/coffee +7 -0
- data/node_modules/coffee-script/extras/jsl.conf +44 -0
- data/node_modules/coffee-script/lib/coffee-script/browser.js +92 -0
- data/node_modules/coffee-script/lib/coffee-script/cake.js +113 -0
- data/node_modules/coffee-script/lib/coffee-script/coffee-script.js +171 -0
- data/node_modules/coffee-script/lib/coffee-script/command.js +502 -0
- data/node_modules/coffee-script/lib/coffee-script/grammar.js +606 -0
- data/node_modules/coffee-script/lib/coffee-script/helpers.js +88 -0
- data/node_modules/coffee-script/lib/coffee-script/index.js +11 -0
- data/node_modules/coffee-script/lib/coffee-script/lexer.js +788 -0
- data/node_modules/coffee-script/lib/coffee-script/nodes.js +2971 -0
- data/node_modules/coffee-script/lib/coffee-script/optparse.js +138 -0
- data/node_modules/coffee-script/lib/coffee-script/parser.js +683 -0
- data/node_modules/coffee-script/lib/coffee-script/repl.js +276 -0
- data/node_modules/coffee-script/lib/coffee-script/rewriter.js +349 -0
- data/node_modules/coffee-script/lib/coffee-script/scope.js +146 -0
- data/node_modules/coffee-script/package.json +50 -0
- data/node_modules/jade-runtime/.npmignore +15 -0
- data/node_modules/jade-runtime/README.md +8 -0
- data/node_modules/jade-runtime/globals.js +32 -0
- data/node_modules/jade-runtime/index.js +2 -0
- data/node_modules/jade-runtime/jade-runtime.js +181 -0
- data/node_modules/jade-runtime/package.json +18 -0
- data/node_modules/jade/.npmignore +14 -0
- data/node_modules/jade/LICENSE +22 -0
- data/node_modules/jade/Readme.md +1299 -0
- data/node_modules/jade/bin/jade +168 -0
- data/node_modules/jade/index.js +4 -0
- data/node_modules/jade/jade.js +3586 -0
- data/node_modules/jade/jade.md +510 -0
- data/node_modules/jade/jade.min.js +2 -0
- data/node_modules/jade/lib/compiler.js +654 -0
- data/node_modules/jade/lib/doctypes.js +18 -0
- data/node_modules/jade/lib/filters.js +97 -0
- data/node_modules/jade/lib/inline-tags.js +28 -0
- data/node_modules/jade/lib/jade.js +253 -0
- data/node_modules/jade/lib/lexer.js +774 -0
- data/node_modules/jade/lib/nodes/attrs.js +77 -0
- data/node_modules/jade/lib/nodes/block-comment.js +33 -0
- data/node_modules/jade/lib/nodes/block.js +122 -0
- data/node_modules/jade/lib/nodes/case.js +43 -0
- data/node_modules/jade/lib/nodes/code.js +35 -0
- data/node_modules/jade/lib/nodes/comment.js +32 -0
- data/node_modules/jade/lib/nodes/doctype.js +29 -0
- data/node_modules/jade/lib/nodes/each.js +35 -0
- data/node_modules/jade/lib/nodes/filter.js +35 -0
- data/node_modules/jade/lib/nodes/index.js +20 -0
- data/node_modules/jade/lib/nodes/literal.js +32 -0
- data/node_modules/jade/lib/nodes/mixin.js +36 -0
- data/node_modules/jade/lib/nodes/node.js +25 -0
- data/node_modules/jade/lib/nodes/tag.js +95 -0
- data/node_modules/jade/lib/nodes/text.js +36 -0
- data/node_modules/jade/lib/parser.js +714 -0
- data/node_modules/jade/lib/runtime.js +174 -0
- data/node_modules/jade/lib/self-closing.js +19 -0
- data/node_modules/jade/lib/utils.js +49 -0
- data/node_modules/jade/node_modules/commander/.npmignore +4 -0
- data/node_modules/jade/node_modules/commander/.travis.yml +4 -0
- data/node_modules/jade/node_modules/commander/History.md +107 -0
- data/node_modules/jade/node_modules/commander/Makefile +7 -0
- data/node_modules/jade/node_modules/commander/Readme.md +262 -0
- data/node_modules/jade/node_modules/commander/index.js +2 -0
- data/node_modules/jade/node_modules/commander/lib/commander.js +1026 -0
- data/node_modules/jade/node_modules/commander/package.json +39 -0
- data/node_modules/jade/node_modules/mkdirp/.npmignore +2 -0
- data/node_modules/jade/node_modules/mkdirp/.travis.yml +4 -0
- data/node_modules/jade/node_modules/mkdirp/LICENSE +21 -0
- data/node_modules/jade/node_modules/mkdirp/README.markdown +61 -0
- data/node_modules/jade/node_modules/mkdirp/examples/pow.js +6 -0
- data/node_modules/jade/node_modules/mkdirp/index.js +82 -0
- data/node_modules/jade/node_modules/mkdirp/package.json +37 -0
- data/node_modules/jade/node_modules/mkdirp/test/chmod.js +38 -0
- data/node_modules/jade/node_modules/mkdirp/test/clobber.js +37 -0
- data/node_modules/jade/node_modules/mkdirp/test/mkdirp.js +28 -0
- data/node_modules/jade/node_modules/mkdirp/test/perm.js +32 -0
- data/node_modules/jade/node_modules/mkdirp/test/perm_sync.js +39 -0
- data/node_modules/jade/node_modules/mkdirp/test/race.js +41 -0
- data/node_modules/jade/node_modules/mkdirp/test/rel.js +32 -0
- data/node_modules/jade/node_modules/mkdirp/test/return.js +25 -0
- data/node_modules/jade/node_modules/mkdirp/test/return_sync.js +24 -0
- data/node_modules/jade/node_modules/mkdirp/test/root.js +18 -0
- data/node_modules/jade/node_modules/mkdirp/test/sync.js +32 -0
- data/node_modules/jade/node_modules/mkdirp/test/umask.js +28 -0
- data/node_modules/jade/node_modules/mkdirp/test/umask_sync.js +32 -0
- data/node_modules/jade/package.json +53 -0
- data/node_modules/jade/runtime.js +179 -0
- data/node_modules/jade/runtime.min.js +1 -0
- data/node_modules/jade/test.jade +7 -0
- data/node_modules/jade/testing/head.jade +5 -0
- data/node_modules/jade/testing/index.jade +1 -0
- data/node_modules/jade/testing/index.js +14 -0
- data/node_modules/jade/testing/layout.jade +10 -0
- data/node_modules/jade/testing/user.jade +7 -0
- data/node_modules/jade/testing/user.js +27 -0
- data/node_modules/optimist/.travis.yml +4 -0
- data/node_modules/optimist/LICENSE +21 -0
- data/node_modules/optimist/README.markdown +487 -0
- data/node_modules/optimist/example/bool.js +10 -0
- data/node_modules/optimist/example/boolean_double.js +7 -0
- data/node_modules/optimist/example/boolean_single.js +7 -0
- data/node_modules/optimist/example/default_hash.js +8 -0
- data/node_modules/optimist/example/default_singles.js +7 -0
- data/node_modules/optimist/example/divide.js +8 -0
- data/node_modules/optimist/example/line_count.js +20 -0
- data/node_modules/optimist/example/line_count_options.js +29 -0
- data/node_modules/optimist/example/line_count_wrap.js +29 -0
- data/node_modules/optimist/example/nonopt.js +4 -0
- data/node_modules/optimist/example/reflect.js +2 -0
- data/node_modules/optimist/example/short.js +3 -0
- data/node_modules/optimist/example/string.js +11 -0
- data/node_modules/optimist/example/usage-options.js +19 -0
- data/node_modules/optimist/example/xup.js +10 -0
- data/node_modules/optimist/index.js +475 -0
- data/node_modules/optimist/node_modules/wordwrap/.npmignore +1 -0
- data/node_modules/optimist/node_modules/wordwrap/README.markdown +70 -0
- data/node_modules/optimist/node_modules/wordwrap/example/center.js +10 -0
- data/node_modules/optimist/node_modules/wordwrap/example/meat.js +3 -0
- data/node_modules/optimist/node_modules/wordwrap/index.js +76 -0
- data/node_modules/optimist/node_modules/wordwrap/package.json +45 -0
- data/node_modules/optimist/node_modules/wordwrap/test/break.js +30 -0
- data/node_modules/optimist/node_modules/wordwrap/test/idleness.txt +63 -0
- data/node_modules/optimist/node_modules/wordwrap/test/wrap.js +31 -0
- data/node_modules/optimist/package.json +55 -0
- data/node_modules/optimist/test/_.js +71 -0
- data/node_modules/optimist/test/_/argv.js +2 -0
- data/node_modules/optimist/test/_/bin.js +3 -0
- data/node_modules/optimist/test/parse.js +420 -0
- data/node_modules/optimist/test/usage.js +292 -0
- data/snowball.gemspec +1 -2
- metadata +601 -21
- data/extconf.rb +0 -9
@@ -0,0 +1,168 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Module dependencies.
|
5
|
+
*/
|
6
|
+
|
7
|
+
var fs = require('fs')
|
8
|
+
, program = require('commander')
|
9
|
+
, path = require('path')
|
10
|
+
, basename = path.basename
|
11
|
+
, dirname = path.dirname
|
12
|
+
, resolve = path.resolve
|
13
|
+
, exists = fs.existsSync || path.existsSync
|
14
|
+
, join = path.join
|
15
|
+
, mkdirp = require('mkdirp')
|
16
|
+
, jade = require('../');
|
17
|
+
|
18
|
+
// jade options
|
19
|
+
|
20
|
+
var options = {};
|
21
|
+
|
22
|
+
// options
|
23
|
+
|
24
|
+
program
|
25
|
+
.version(jade.version)
|
26
|
+
.usage('[options] [dir|file ...]')
|
27
|
+
.option('-o, --obj <str>', 'javascript options object')
|
28
|
+
.option('-O, --out <dir>', 'output the compiled html to <dir>')
|
29
|
+
.option('-p, --path <path>', 'filename used to resolve includes')
|
30
|
+
.option('-P, --pretty', 'compile pretty html output')
|
31
|
+
.option('-c, --client', 'compile function for client-side runtime.js')
|
32
|
+
.option('-D, --no-debug', 'compile without debugging (smaller functions)')
|
33
|
+
.option('-w, --watch', 'watch files for changes and automatically re-render')
|
34
|
+
|
35
|
+
program.on('--help', function(){
|
36
|
+
console.log(' Examples:');
|
37
|
+
console.log('');
|
38
|
+
console.log(' # translate jade the templates dir');
|
39
|
+
console.log(' $ jade templates');
|
40
|
+
console.log('');
|
41
|
+
console.log(' # create {foo,bar}.html');
|
42
|
+
console.log(' $ jade {foo,bar}.jade');
|
43
|
+
console.log('');
|
44
|
+
console.log(' # jade over stdio');
|
45
|
+
console.log(' $ jade < my.jade > my.html');
|
46
|
+
console.log('');
|
47
|
+
console.log(' # jade over stdio');
|
48
|
+
console.log(' $ echo "h1 Jade!" | jade');
|
49
|
+
console.log('');
|
50
|
+
console.log(' # foo, bar dirs rendering to /tmp');
|
51
|
+
console.log(' $ jade foo bar --out /tmp ');
|
52
|
+
console.log('');
|
53
|
+
});
|
54
|
+
|
55
|
+
program.parse(process.argv);
|
56
|
+
|
57
|
+
// options given, parse them
|
58
|
+
|
59
|
+
if (program.obj) {
|
60
|
+
if (exists(program.obj)) {
|
61
|
+
options = JSON.parse(fs.readFileSync(program.obj));
|
62
|
+
} else {
|
63
|
+
options = eval('(' + program.obj + ')');
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
// --filename
|
68
|
+
|
69
|
+
if (program.path) options.filename = program.path;
|
70
|
+
|
71
|
+
// --no-debug
|
72
|
+
|
73
|
+
options.compileDebug = program.debug;
|
74
|
+
|
75
|
+
// --client
|
76
|
+
|
77
|
+
options.client = program.client;
|
78
|
+
|
79
|
+
// --pretty
|
80
|
+
|
81
|
+
options.pretty = program.pretty;
|
82
|
+
|
83
|
+
// --watch
|
84
|
+
|
85
|
+
options.watch = program.watch;
|
86
|
+
|
87
|
+
// left-over args are file paths
|
88
|
+
|
89
|
+
var files = program.args;
|
90
|
+
|
91
|
+
// compile files
|
92
|
+
|
93
|
+
if (files.length) {
|
94
|
+
console.log();
|
95
|
+
files.forEach(renderFile);
|
96
|
+
if (options.watch) {
|
97
|
+
files.forEach(function (file) {
|
98
|
+
fs.watchFile(file, {interval: 100}, function (curr, prev) {
|
99
|
+
if (curr.mtime > prev.mtime) renderFile(file);
|
100
|
+
});
|
101
|
+
});
|
102
|
+
}
|
103
|
+
process.on('exit', function () {
|
104
|
+
console.log();
|
105
|
+
});
|
106
|
+
// stdio
|
107
|
+
} else {
|
108
|
+
stdin();
|
109
|
+
}
|
110
|
+
|
111
|
+
/**
|
112
|
+
* Compile from stdin.
|
113
|
+
*/
|
114
|
+
|
115
|
+
function stdin() {
|
116
|
+
var buf = '';
|
117
|
+
process.stdin.setEncoding('utf8');
|
118
|
+
process.stdin.on('data', function(chunk){ buf += chunk; });
|
119
|
+
process.stdin.on('end', function(){
|
120
|
+
var fn = jade.compile(buf, options);
|
121
|
+
var output = options.client
|
122
|
+
? fn.toString()
|
123
|
+
: fn(options);
|
124
|
+
process.stdout.write(output);
|
125
|
+
}).resume();
|
126
|
+
}
|
127
|
+
|
128
|
+
/**
|
129
|
+
* Process the given path, compiling the jade files found.
|
130
|
+
* Always walk the subdirectories.
|
131
|
+
*/
|
132
|
+
|
133
|
+
function renderFile(path) {
|
134
|
+
var re = /\.jade$/;
|
135
|
+
fs.lstat(path, function(err, stat) {
|
136
|
+
if (err) throw err;
|
137
|
+
// Found jade file
|
138
|
+
if (stat.isFile() && re.test(path)) {
|
139
|
+
fs.readFile(path, 'utf8', function(err, str){
|
140
|
+
if (err) throw err;
|
141
|
+
options.filename = path;
|
142
|
+
var fn = jade.compile(str, options);
|
143
|
+
var extname = options.client ? '.js' : '.html';
|
144
|
+
path = path.replace(re, extname);
|
145
|
+
if (program.out) path = join(program.out, basename(path));
|
146
|
+
var dir = resolve(dirname(path));
|
147
|
+
mkdirp(dir, 0755, function(err){
|
148
|
+
if (err) throw err;
|
149
|
+
var output = options.client
|
150
|
+
? fn.toString()
|
151
|
+
: fn(options);
|
152
|
+
fs.writeFile(path, output, function(err){
|
153
|
+
if (err) throw err;
|
154
|
+
console.log(' \033[90mrendered \033[36m%s\033[0m', path);
|
155
|
+
});
|
156
|
+
});
|
157
|
+
});
|
158
|
+
// Found directory
|
159
|
+
} else if (stat.isDirectory()) {
|
160
|
+
fs.readdir(path, function(err, files) {
|
161
|
+
if (err) throw err;
|
162
|
+
files.map(function(filename) {
|
163
|
+
return path + '/' + filename;
|
164
|
+
}).forEach(renderFile);
|
165
|
+
});
|
166
|
+
}
|
167
|
+
});
|
168
|
+
}
|
@@ -0,0 +1,3586 @@
|
|
1
|
+
(function() {
|
2
|
+
|
3
|
+
// CommonJS require()
|
4
|
+
|
5
|
+
function require(p){
|
6
|
+
var path = require.resolve(p)
|
7
|
+
, mod = require.modules[path];
|
8
|
+
if (!mod) throw new Error('failed to require "' + p + '"');
|
9
|
+
if (!mod.exports) {
|
10
|
+
mod.exports = {};
|
11
|
+
mod.call(mod.exports, mod, mod.exports, require.relative(path));
|
12
|
+
}
|
13
|
+
return mod.exports;
|
14
|
+
}
|
15
|
+
|
16
|
+
require.modules = {};
|
17
|
+
|
18
|
+
require.resolve = function (path){
|
19
|
+
var orig = path
|
20
|
+
, reg = path + '.js'
|
21
|
+
, index = path + '/index.js';
|
22
|
+
return require.modules[reg] && reg
|
23
|
+
|| require.modules[index] && index
|
24
|
+
|| orig;
|
25
|
+
};
|
26
|
+
|
27
|
+
require.register = function (path, fn){
|
28
|
+
require.modules[path] = fn;
|
29
|
+
};
|
30
|
+
|
31
|
+
require.relative = function (parent) {
|
32
|
+
return function(p){
|
33
|
+
if ('.' != p.charAt(0)) return require(p);
|
34
|
+
|
35
|
+
var path = parent.split('/')
|
36
|
+
, segs = p.split('/');
|
37
|
+
path.pop();
|
38
|
+
|
39
|
+
for (var i = 0; i < segs.length; i++) {
|
40
|
+
var seg = segs[i];
|
41
|
+
if ('..' == seg) path.pop();
|
42
|
+
else if ('.' != seg) path.push(seg);
|
43
|
+
}
|
44
|
+
|
45
|
+
return require(path.join('/'));
|
46
|
+
};
|
47
|
+
};
|
48
|
+
|
49
|
+
|
50
|
+
require.register("compiler.js", function(module, exports, require){
|
51
|
+
|
52
|
+
/*!
|
53
|
+
* Jade - Compiler
|
54
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
55
|
+
* MIT Licensed
|
56
|
+
*/
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Module dependencies.
|
60
|
+
*/
|
61
|
+
|
62
|
+
var nodes = require('./nodes')
|
63
|
+
, filters = require('./filters')
|
64
|
+
, doctypes = require('./doctypes')
|
65
|
+
, selfClosing = require('./self-closing')
|
66
|
+
, runtime = require('./runtime')
|
67
|
+
, utils = require('./utils');
|
68
|
+
|
69
|
+
|
70
|
+
if (!Object.keys) {
|
71
|
+
Object.keys = function(obj){
|
72
|
+
var arr = [];
|
73
|
+
for (var key in obj) {
|
74
|
+
if (obj.hasOwnProperty(key)) {
|
75
|
+
arr.push(key);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
return arr;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
if (!String.prototype.trimLeft) {
|
83
|
+
String.prototype.trimLeft = function(){
|
84
|
+
return this.replace(/^\s+/, '');
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
/**
|
91
|
+
* Initialize `Compiler` with the given `node`.
|
92
|
+
*
|
93
|
+
* @param {Node} node
|
94
|
+
* @param {Object} options
|
95
|
+
* @api public
|
96
|
+
*/
|
97
|
+
|
98
|
+
var Compiler = module.exports = function Compiler(node, options) {
|
99
|
+
this.options = options = options || {};
|
100
|
+
this.node = node;
|
101
|
+
this.hasCompiledDoctype = false;
|
102
|
+
this.hasCompiledTag = false;
|
103
|
+
this.pp = options.pretty || false;
|
104
|
+
this.debug = false !== options.compileDebug;
|
105
|
+
this.indents = 0;
|
106
|
+
this.parentIndents = 0;
|
107
|
+
if (options.doctype) this.setDoctype(options.doctype);
|
108
|
+
};
|
109
|
+
|
110
|
+
/**
|
111
|
+
* Compiler prototype.
|
112
|
+
*/
|
113
|
+
|
114
|
+
Compiler.prototype = {
|
115
|
+
|
116
|
+
/**
|
117
|
+
* Compile parse tree to JavaScript.
|
118
|
+
*
|
119
|
+
* @api public
|
120
|
+
*/
|
121
|
+
|
122
|
+
compile: function(){
|
123
|
+
this.buf = ['var interp;'];
|
124
|
+
if (this.pp) this.buf.push("var __indent = [];");
|
125
|
+
this.lastBufferedIdx = -1;
|
126
|
+
this.visit(this.node);
|
127
|
+
return this.buf.join('\n');
|
128
|
+
},
|
129
|
+
|
130
|
+
/**
|
131
|
+
* Sets the default doctype `name`. Sets terse mode to `true` when
|
132
|
+
* html 5 is used, causing self-closing tags to end with ">" vs "/>",
|
133
|
+
* and boolean attributes are not mirrored.
|
134
|
+
*
|
135
|
+
* @param {string} name
|
136
|
+
* @api public
|
137
|
+
*/
|
138
|
+
|
139
|
+
setDoctype: function(name){
|
140
|
+
var doctype = doctypes[(name || 'default').toLowerCase()];
|
141
|
+
doctype = doctype || '<!DOCTYPE ' + name + '>';
|
142
|
+
this.doctype = doctype;
|
143
|
+
this.terse = '5' == name || 'html' == name;
|
144
|
+
this.xml = 0 == this.doctype.indexOf('<?xml');
|
145
|
+
},
|
146
|
+
|
147
|
+
/**
|
148
|
+
* Buffer the given `str` optionally escaped.
|
149
|
+
*
|
150
|
+
* @param {String} str
|
151
|
+
* @param {Boolean} esc
|
152
|
+
* @api public
|
153
|
+
*/
|
154
|
+
|
155
|
+
buffer: function(str, esc){
|
156
|
+
if (esc) str = utils.escape(str);
|
157
|
+
|
158
|
+
if (this.lastBufferedIdx == this.buf.length) {
|
159
|
+
this.lastBuffered += str;
|
160
|
+
this.buf[this.lastBufferedIdx - 1] = "buf.push('" + this.lastBuffered + "');"
|
161
|
+
} else {
|
162
|
+
this.buf.push("buf.push('" + str + "');");
|
163
|
+
this.lastBuffered = str;
|
164
|
+
this.lastBufferedIdx = this.buf.length;
|
165
|
+
}
|
166
|
+
},
|
167
|
+
|
168
|
+
/**
|
169
|
+
* Buffer an indent based on the current `indent`
|
170
|
+
* property and an additional `offset`.
|
171
|
+
*
|
172
|
+
* @param {Number} offset
|
173
|
+
* @param {Boolean} newline
|
174
|
+
* @api public
|
175
|
+
*/
|
176
|
+
|
177
|
+
prettyIndent: function(offset, newline){
|
178
|
+
offset = offset || 0;
|
179
|
+
newline = newline ? '\\n' : '';
|
180
|
+
this.buffer(newline + Array(this.indents + offset).join(' '));
|
181
|
+
if (this.parentIndents)
|
182
|
+
this.buf.push("buf.push.apply(buf, __indent);");
|
183
|
+
},
|
184
|
+
|
185
|
+
/**
|
186
|
+
* Visit `node`.
|
187
|
+
*
|
188
|
+
* @param {Node} node
|
189
|
+
* @api public
|
190
|
+
*/
|
191
|
+
|
192
|
+
visit: function(node){
|
193
|
+
var debug = this.debug;
|
194
|
+
|
195
|
+
if (debug) {
|
196
|
+
this.buf.push('__jade.unshift({ lineno: ' + node.line
|
197
|
+
+ ', filename: ' + (node.filename
|
198
|
+
? JSON.stringify(node.filename)
|
199
|
+
: '__jade[0].filename')
|
200
|
+
+ ' });');
|
201
|
+
}
|
202
|
+
|
203
|
+
// Massive hack to fix our context
|
204
|
+
// stack for - else[ if] etc
|
205
|
+
if (false === node.debug && this.debug) {
|
206
|
+
this.buf.pop();
|
207
|
+
this.buf.pop();
|
208
|
+
}
|
209
|
+
|
210
|
+
this.visitNode(node);
|
211
|
+
|
212
|
+
if (debug) this.buf.push('__jade.shift();');
|
213
|
+
},
|
214
|
+
|
215
|
+
/**
|
216
|
+
* Visit `node`.
|
217
|
+
*
|
218
|
+
* @param {Node} node
|
219
|
+
* @api public
|
220
|
+
*/
|
221
|
+
|
222
|
+
visitNode: function(node){
|
223
|
+
var name = node.constructor.name
|
224
|
+
|| node.constructor.toString().match(/function ([^(\s]+)()/)[1];
|
225
|
+
return this['visit' + name](node);
|
226
|
+
},
|
227
|
+
|
228
|
+
/**
|
229
|
+
* Visit case `node`.
|
230
|
+
*
|
231
|
+
* @param {Literal} node
|
232
|
+
* @api public
|
233
|
+
*/
|
234
|
+
|
235
|
+
visitCase: function(node){
|
236
|
+
var _ = this.withinCase;
|
237
|
+
this.withinCase = true;
|
238
|
+
this.buf.push('switch (' + node.expr + '){');
|
239
|
+
this.visit(node.block);
|
240
|
+
this.buf.push('}');
|
241
|
+
this.withinCase = _;
|
242
|
+
},
|
243
|
+
|
244
|
+
/**
|
245
|
+
* Visit when `node`.
|
246
|
+
*
|
247
|
+
* @param {Literal} node
|
248
|
+
* @api public
|
249
|
+
*/
|
250
|
+
|
251
|
+
visitWhen: function(node){
|
252
|
+
if ('default' == node.expr) {
|
253
|
+
this.buf.push('default:');
|
254
|
+
} else {
|
255
|
+
this.buf.push('case ' + node.expr + ':');
|
256
|
+
}
|
257
|
+
this.visit(node.block);
|
258
|
+
this.buf.push(' break;');
|
259
|
+
},
|
260
|
+
|
261
|
+
/**
|
262
|
+
* Visit literal `node`.
|
263
|
+
*
|
264
|
+
* @param {Literal} node
|
265
|
+
* @api public
|
266
|
+
*/
|
267
|
+
|
268
|
+
visitLiteral: function(node){
|
269
|
+
var str = node.str.replace(/\n/g, '\\\\n');
|
270
|
+
this.buffer(str);
|
271
|
+
},
|
272
|
+
|
273
|
+
/**
|
274
|
+
* Visit all nodes in `block`.
|
275
|
+
*
|
276
|
+
* @param {Block} block
|
277
|
+
* @api public
|
278
|
+
*/
|
279
|
+
|
280
|
+
visitBlock: function(block){
|
281
|
+
var len = block.nodes.length
|
282
|
+
, escape = this.escape
|
283
|
+
, pp = this.pp
|
284
|
+
|
285
|
+
// Block keyword has a special meaning in mixins
|
286
|
+
if (this.parentIndents && block.mode) {
|
287
|
+
if (pp) this.buf.push("__indent.push('" + Array(this.indents + 1).join(' ') + "');")
|
288
|
+
this.buf.push('block && block();');
|
289
|
+
if (pp) this.buf.push("__indent.pop();")
|
290
|
+
return;
|
291
|
+
}
|
292
|
+
|
293
|
+
// Pretty print multi-line text
|
294
|
+
if (pp && len > 1 && !escape && block.nodes[0].isText && block.nodes[1].isText)
|
295
|
+
this.prettyIndent(1, true);
|
296
|
+
|
297
|
+
for (var i = 0; i < len; ++i) {
|
298
|
+
// Pretty print text
|
299
|
+
if (pp && i > 0 && !escape && block.nodes[i].isText && block.nodes[i-1].isText)
|
300
|
+
this.prettyIndent(1, false);
|
301
|
+
|
302
|
+
this.visit(block.nodes[i]);
|
303
|
+
// Multiple text nodes are separated by newlines
|
304
|
+
if (block.nodes[i+1] && block.nodes[i].isText && block.nodes[i+1].isText)
|
305
|
+
this.buffer('\\n');
|
306
|
+
}
|
307
|
+
},
|
308
|
+
|
309
|
+
/**
|
310
|
+
* Visit `doctype`. Sets terse mode to `true` when html 5
|
311
|
+
* is used, causing self-closing tags to end with ">" vs "/>",
|
312
|
+
* and boolean attributes are not mirrored.
|
313
|
+
*
|
314
|
+
* @param {Doctype} doctype
|
315
|
+
* @api public
|
316
|
+
*/
|
317
|
+
|
318
|
+
visitDoctype: function(doctype){
|
319
|
+
if (doctype && (doctype.val || !this.doctype)) {
|
320
|
+
this.setDoctype(doctype.val || 'default');
|
321
|
+
}
|
322
|
+
|
323
|
+
if (this.doctype) this.buffer(this.doctype);
|
324
|
+
this.hasCompiledDoctype = true;
|
325
|
+
},
|
326
|
+
|
327
|
+
/**
|
328
|
+
* Visit `mixin`, generating a function that
|
329
|
+
* may be called within the template.
|
330
|
+
*
|
331
|
+
* @param {Mixin} mixin
|
332
|
+
* @api public
|
333
|
+
*/
|
334
|
+
|
335
|
+
visitMixin: function(mixin){
|
336
|
+
var name = mixin.name.replace(/-/g, '_') + '_mixin'
|
337
|
+
, args = mixin.args || ''
|
338
|
+
, block = mixin.block
|
339
|
+
, attrs = mixin.attrs
|
340
|
+
, pp = this.pp;
|
341
|
+
|
342
|
+
if (mixin.call) {
|
343
|
+
if (pp) this.buf.push("__indent.push('" + Array(this.indents + 1).join(' ') + "');")
|
344
|
+
if (block || attrs.length) {
|
345
|
+
|
346
|
+
this.buf.push(name + '.call({');
|
347
|
+
|
348
|
+
if (block) {
|
349
|
+
this.buf.push('block: function(){');
|
350
|
+
|
351
|
+
// Render block with no indents, dynamically added when rendered
|
352
|
+
this.parentIndents++;
|
353
|
+
var _indents = this.indents;
|
354
|
+
this.indents = 0;
|
355
|
+
this.visit(mixin.block);
|
356
|
+
this.indents = _indents;
|
357
|
+
this.parentIndents--;
|
358
|
+
|
359
|
+
if (attrs.length) {
|
360
|
+
this.buf.push('},');
|
361
|
+
} else {
|
362
|
+
this.buf.push('}');
|
363
|
+
}
|
364
|
+
}
|
365
|
+
|
366
|
+
if (attrs.length) {
|
367
|
+
var val = this.attrs(attrs);
|
368
|
+
if (val.inherits) {
|
369
|
+
this.buf.push('attributes: merge({' + val.buf
|
370
|
+
+ '}, attributes), escaped: merge(' + val.escaped + ', escaped, true)');
|
371
|
+
} else {
|
372
|
+
this.buf.push('attributes: {' + val.buf + '}, escaped: ' + val.escaped);
|
373
|
+
}
|
374
|
+
}
|
375
|
+
|
376
|
+
if (args) {
|
377
|
+
this.buf.push('}, ' + args + ');');
|
378
|
+
} else {
|
379
|
+
this.buf.push('});');
|
380
|
+
}
|
381
|
+
|
382
|
+
} else {
|
383
|
+
this.buf.push(name + '(' + args + ');');
|
384
|
+
}
|
385
|
+
if (pp) this.buf.push("__indent.pop();")
|
386
|
+
} else {
|
387
|
+
this.buf.push('var ' + name + ' = function(' + args + '){');
|
388
|
+
this.buf.push('var block = this.block, attributes = this.attributes || {}, escaped = this.escaped || {};');
|
389
|
+
this.parentIndents++;
|
390
|
+
this.visit(block);
|
391
|
+
this.parentIndents--;
|
392
|
+
this.buf.push('};');
|
393
|
+
}
|
394
|
+
},
|
395
|
+
|
396
|
+
/**
|
397
|
+
* Visit `tag` buffering tag markup, generating
|
398
|
+
* attributes, visiting the `tag`'s code and block.
|
399
|
+
*
|
400
|
+
* @param {Tag} tag
|
401
|
+
* @api public
|
402
|
+
*/
|
403
|
+
|
404
|
+
visitTag: function(tag){
|
405
|
+
this.indents++;
|
406
|
+
var name = tag.name
|
407
|
+
, pp = this.pp;
|
408
|
+
|
409
|
+
if (tag.buffer) name = "' + (" + name + ") + '";
|
410
|
+
|
411
|
+
if (!this.hasCompiledTag) {
|
412
|
+
if (!this.hasCompiledDoctype && 'html' == name) {
|
413
|
+
this.visitDoctype();
|
414
|
+
}
|
415
|
+
this.hasCompiledTag = true;
|
416
|
+
}
|
417
|
+
|
418
|
+
// pretty print
|
419
|
+
if (pp && !tag.isInline())
|
420
|
+
this.prettyIndent(0, true);
|
421
|
+
|
422
|
+
if ((~selfClosing.indexOf(name) || tag.selfClosing) && !this.xml) {
|
423
|
+
this.buffer('<' + name);
|
424
|
+
this.visitAttributes(tag.attrs);
|
425
|
+
this.terse
|
426
|
+
? this.buffer('>')
|
427
|
+
: this.buffer('/>');
|
428
|
+
} else {
|
429
|
+
// Optimize attributes buffering
|
430
|
+
if (tag.attrs.length) {
|
431
|
+
this.buffer('<' + name);
|
432
|
+
if (tag.attrs.length) this.visitAttributes(tag.attrs);
|
433
|
+
this.buffer('>');
|
434
|
+
} else {
|
435
|
+
this.buffer('<' + name + '>');
|
436
|
+
}
|
437
|
+
if (tag.code) this.visitCode(tag.code);
|
438
|
+
this.escape = 'pre' == tag.name;
|
439
|
+
this.visit(tag.block);
|
440
|
+
|
441
|
+
// pretty print
|
442
|
+
if (pp && !tag.isInline() && 'pre' != tag.name && !tag.canInline())
|
443
|
+
this.prettyIndent(0, true);
|
444
|
+
|
445
|
+
this.buffer('</' + name + '>');
|
446
|
+
}
|
447
|
+
this.indents--;
|
448
|
+
},
|
449
|
+
|
450
|
+
/**
|
451
|
+
* Visit `filter`, throwing when the filter does not exist.
|
452
|
+
*
|
453
|
+
* @param {Filter} filter
|
454
|
+
* @api public
|
455
|
+
*/
|
456
|
+
|
457
|
+
visitFilter: function(filter){
|
458
|
+
var fn = filters[filter.name];
|
459
|
+
|
460
|
+
// unknown filter
|
461
|
+
if (!fn) {
|
462
|
+
if (filter.isASTFilter) {
|
463
|
+
throw new Error('unknown ast filter "' + filter.name + ':"');
|
464
|
+
} else {
|
465
|
+
throw new Error('unknown filter ":' + filter.name + '"');
|
466
|
+
}
|
467
|
+
}
|
468
|
+
|
469
|
+
if (filter.isASTFilter) {
|
470
|
+
this.buf.push(fn(filter.block, this, filter.attrs));
|
471
|
+
} else {
|
472
|
+
var text = filter.block.nodes.map(function(node){ return node.val }).join('\n');
|
473
|
+
filter.attrs = filter.attrs || {};
|
474
|
+
filter.attrs.filename = this.options.filename;
|
475
|
+
this.buffer(utils.text(fn(text, filter.attrs)));
|
476
|
+
}
|
477
|
+
},
|
478
|
+
|
479
|
+
/**
|
480
|
+
* Visit `text` node.
|
481
|
+
*
|
482
|
+
* @param {Text} text
|
483
|
+
* @api public
|
484
|
+
*/
|
485
|
+
|
486
|
+
visitText: function(text){
|
487
|
+
text = utils.text(text.val.replace(/\\/g, '\\\\'));
|
488
|
+
if (this.escape) text = escape(text);
|
489
|
+
this.buffer(text);
|
490
|
+
},
|
491
|
+
|
492
|
+
/**
|
493
|
+
* Visit a `comment`, only buffering when the buffer flag is set.
|
494
|
+
*
|
495
|
+
* @param {Comment} comment
|
496
|
+
* @api public
|
497
|
+
*/
|
498
|
+
|
499
|
+
visitComment: function(comment){
|
500
|
+
if (!comment.buffer) return;
|
501
|
+
if (this.pp) this.prettyIndent(1, true);
|
502
|
+
this.buffer('<!--' + utils.escape(comment.val) + '-->');
|
503
|
+
},
|
504
|
+
|
505
|
+
/**
|
506
|
+
* Visit a `BlockComment`.
|
507
|
+
*
|
508
|
+
* @param {Comment} comment
|
509
|
+
* @api public
|
510
|
+
*/
|
511
|
+
|
512
|
+
visitBlockComment: function(comment){
|
513
|
+
if (!comment.buffer) return;
|
514
|
+
if (0 == comment.val.trim().indexOf('if')) {
|
515
|
+
this.buffer('<!--[' + comment.val.trim() + ']>');
|
516
|
+
this.visit(comment.block);
|
517
|
+
this.buffer('<![endif]-->');
|
518
|
+
} else {
|
519
|
+
this.buffer('<!--' + comment.val);
|
520
|
+
this.visit(comment.block);
|
521
|
+
this.buffer('-->');
|
522
|
+
}
|
523
|
+
},
|
524
|
+
|
525
|
+
/**
|
526
|
+
* Visit `code`, respecting buffer / escape flags.
|
527
|
+
* If the code is followed by a block, wrap it in
|
528
|
+
* a self-calling function.
|
529
|
+
*
|
530
|
+
* @param {Code} code
|
531
|
+
* @api public
|
532
|
+
*/
|
533
|
+
|
534
|
+
visitCode: function(code){
|
535
|
+
// Wrap code blocks with {}.
|
536
|
+
// we only wrap unbuffered code blocks ATM
|
537
|
+
// since they are usually flow control
|
538
|
+
|
539
|
+
// Buffer code
|
540
|
+
if (code.buffer) {
|
541
|
+
var val = code.val.trimLeft();
|
542
|
+
this.buf.push('var __val__ = ' + val);
|
543
|
+
val = 'null == __val__ ? "" : __val__';
|
544
|
+
if (code.escape) val = 'escape(' + val + ')';
|
545
|
+
this.buf.push("buf.push(" + val + ");");
|
546
|
+
} else {
|
547
|
+
this.buf.push(code.val);
|
548
|
+
}
|
549
|
+
|
550
|
+
// Block support
|
551
|
+
if (code.block) {
|
552
|
+
if (!code.buffer) this.buf.push('{');
|
553
|
+
this.visit(code.block);
|
554
|
+
if (!code.buffer) this.buf.push('}');
|
555
|
+
}
|
556
|
+
},
|
557
|
+
|
558
|
+
/**
|
559
|
+
* Visit `each` block.
|
560
|
+
*
|
561
|
+
* @param {Each} each
|
562
|
+
* @api public
|
563
|
+
*/
|
564
|
+
|
565
|
+
visitEach: function(each){
|
566
|
+
this.buf.push(''
|
567
|
+
+ '// iterate ' + each.obj + '\n'
|
568
|
+
+ ';(function(){\n'
|
569
|
+
+ ' if (\'number\' == typeof ' + each.obj + '.length) {\n'
|
570
|
+
+ ' for (var ' + each.key + ' = 0, $$l = ' + each.obj + '.length; ' + each.key + ' < $$l; ' + each.key + '++) {\n'
|
571
|
+
+ ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n');
|
572
|
+
|
573
|
+
this.visit(each.block);
|
574
|
+
|
575
|
+
this.buf.push(''
|
576
|
+
+ ' }\n'
|
577
|
+
+ ' } else {\n'
|
578
|
+
+ ' for (var ' + each.key + ' in ' + each.obj + ') {\n'
|
579
|
+
+ ' if (' + each.obj + '.hasOwnProperty(' + each.key + ')){'
|
580
|
+
+ ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n');
|
581
|
+
|
582
|
+
this.visit(each.block);
|
583
|
+
|
584
|
+
this.buf.push(' }\n');
|
585
|
+
|
586
|
+
this.buf.push(' }\n }\n}).call(this);\n');
|
587
|
+
},
|
588
|
+
|
589
|
+
/**
|
590
|
+
* Visit `attrs`.
|
591
|
+
*
|
592
|
+
* @param {Array} attrs
|
593
|
+
* @api public
|
594
|
+
*/
|
595
|
+
|
596
|
+
visitAttributes: function(attrs){
|
597
|
+
var val = this.attrs(attrs);
|
598
|
+
if (val.inherits) {
|
599
|
+
this.buf.push("buf.push(attrs(merge({ " + val.buf +
|
600
|
+
" }, attributes), merge(" + val.escaped + ", escaped, true)));");
|
601
|
+
} else if (val.constant) {
|
602
|
+
eval('var buf={' + val.buf + '};');
|
603
|
+
this.buffer(runtime.attrs(buf, JSON.parse(val.escaped)), true);
|
604
|
+
} else {
|
605
|
+
this.buf.push("buf.push(attrs({ " + val.buf + " }, " + val.escaped + "));");
|
606
|
+
}
|
607
|
+
},
|
608
|
+
|
609
|
+
/**
|
610
|
+
* Compile attributes.
|
611
|
+
*/
|
612
|
+
|
613
|
+
attrs: function(attrs){
|
614
|
+
var buf = []
|
615
|
+
, classes = []
|
616
|
+
, escaped = {}
|
617
|
+
, constant = attrs.every(function(attr){ return isConstant(attr.val) })
|
618
|
+
, inherits = false;
|
619
|
+
|
620
|
+
if (this.terse) buf.push('terse: true');
|
621
|
+
|
622
|
+
attrs.forEach(function(attr){
|
623
|
+
if (attr.name == 'attributes') return inherits = true;
|
624
|
+
escaped[attr.name] = attr.escaped;
|
625
|
+
if (attr.name == 'class') {
|
626
|
+
classes.push('(' + attr.val + ')');
|
627
|
+
} else {
|
628
|
+
var pair = "'" + attr.name + "':(" + attr.val + ')';
|
629
|
+
buf.push(pair);
|
630
|
+
}
|
631
|
+
});
|
632
|
+
|
633
|
+
if (classes.length) {
|
634
|
+
classes = classes.join(" + ' ' + ");
|
635
|
+
buf.push("class: " + classes);
|
636
|
+
}
|
637
|
+
|
638
|
+
return {
|
639
|
+
buf: buf.join(', ').replace('class:', '"class":'),
|
640
|
+
escaped: JSON.stringify(escaped),
|
641
|
+
inherits: inherits,
|
642
|
+
constant: constant
|
643
|
+
};
|
644
|
+
}
|
645
|
+
};
|
646
|
+
|
647
|
+
/**
|
648
|
+
* Check if expression can be evaluated to a constant
|
649
|
+
*
|
650
|
+
* @param {String} expression
|
651
|
+
* @return {Boolean}
|
652
|
+
* @api private
|
653
|
+
*/
|
654
|
+
|
655
|
+
function isConstant(val){
|
656
|
+
// Check strings/literals
|
657
|
+
if (/^ *("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'|true|false|null|undefined) *$/i.test(val))
|
658
|
+
return true;
|
659
|
+
|
660
|
+
// Check numbers
|
661
|
+
if (!isNaN(Number(val)))
|
662
|
+
return true;
|
663
|
+
|
664
|
+
// Check arrays
|
665
|
+
var matches;
|
666
|
+
if (matches = /^ *\[(.*)\] *$/.exec(val))
|
667
|
+
return matches[1].split(',').every(isConstant);
|
668
|
+
|
669
|
+
return false;
|
670
|
+
}
|
671
|
+
|
672
|
+
/**
|
673
|
+
* Escape the given string of `html`.
|
674
|
+
*
|
675
|
+
* @param {String} html
|
676
|
+
* @return {String}
|
677
|
+
* @api private
|
678
|
+
*/
|
679
|
+
|
680
|
+
function escape(html){
|
681
|
+
return String(html)
|
682
|
+
.replace(/&(?!\w+;)/g, '&')
|
683
|
+
.replace(/</g, '<')
|
684
|
+
.replace(/>/g, '>')
|
685
|
+
.replace(/"/g, '"');
|
686
|
+
}
|
687
|
+
}); // module: compiler.js
|
688
|
+
|
689
|
+
require.register("doctypes.js", function(module, exports, require){
|
690
|
+
|
691
|
+
/*!
|
692
|
+
* Jade - doctypes
|
693
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
694
|
+
* MIT Licensed
|
695
|
+
*/
|
696
|
+
|
697
|
+
module.exports = {
|
698
|
+
'5': '<!DOCTYPE html>'
|
699
|
+
, 'default': '<!DOCTYPE html>'
|
700
|
+
, 'xml': '<?xml version="1.0" encoding="utf-8" ?>'
|
701
|
+
, 'transitional': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
|
702
|
+
, 'strict': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
|
703
|
+
, 'frameset': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">'
|
704
|
+
, '1.1': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'
|
705
|
+
, 'basic': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">'
|
706
|
+
, 'mobile': '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">'
|
707
|
+
};
|
708
|
+
}); // module: doctypes.js
|
709
|
+
|
710
|
+
require.register("filters.js", function(module, exports, require){
|
711
|
+
|
712
|
+
/*!
|
713
|
+
* Jade - filters
|
714
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
715
|
+
* MIT Licensed
|
716
|
+
*/
|
717
|
+
|
718
|
+
module.exports = {
|
719
|
+
|
720
|
+
/**
|
721
|
+
* Wrap text with CDATA block.
|
722
|
+
*/
|
723
|
+
|
724
|
+
cdata: function(str){
|
725
|
+
return '<![CDATA[\\n' + str + '\\n]]>';
|
726
|
+
},
|
727
|
+
|
728
|
+
/**
|
729
|
+
* Transform sass to css, wrapped in style tags.
|
730
|
+
*/
|
731
|
+
|
732
|
+
sass: function(str){
|
733
|
+
str = str.replace(/\\n/g, '\n');
|
734
|
+
var sass = require('sass').render(str).replace(/\n/g, '\\n');
|
735
|
+
return '<style type="text/css">' + sass + '</style>';
|
736
|
+
},
|
737
|
+
|
738
|
+
/**
|
739
|
+
* Transform stylus to css, wrapped in style tags.
|
740
|
+
*/
|
741
|
+
|
742
|
+
stylus: function(str, options){
|
743
|
+
var ret;
|
744
|
+
str = str.replace(/\\n/g, '\n');
|
745
|
+
var stylus = require('stylus');
|
746
|
+
stylus(str, options).render(function(err, css){
|
747
|
+
if (err) throw err;
|
748
|
+
ret = css.replace(/\n/g, '\\n');
|
749
|
+
});
|
750
|
+
return '<style type="text/css">' + ret + '</style>';
|
751
|
+
},
|
752
|
+
|
753
|
+
/**
|
754
|
+
* Transform less to css, wrapped in style tags.
|
755
|
+
*/
|
756
|
+
|
757
|
+
less: function(str){
|
758
|
+
var ret;
|
759
|
+
str = str.replace(/\\n/g, '\n');
|
760
|
+
require('less').render(str, function(err, css){
|
761
|
+
if (err) throw err;
|
762
|
+
ret = '<style type="text/css">' + css.replace(/\n/g, '\\n') + '</style>';
|
763
|
+
});
|
764
|
+
return ret;
|
765
|
+
},
|
766
|
+
|
767
|
+
/**
|
768
|
+
* Transform markdown to html.
|
769
|
+
*/
|
770
|
+
|
771
|
+
markdown: function(str){
|
772
|
+
var md;
|
773
|
+
|
774
|
+
// support markdown / discount
|
775
|
+
try {
|
776
|
+
md = require('markdown');
|
777
|
+
} catch (err){
|
778
|
+
try {
|
779
|
+
md = require('discount');
|
780
|
+
} catch (err) {
|
781
|
+
try {
|
782
|
+
md = require('markdown-js');
|
783
|
+
} catch (err) {
|
784
|
+
try {
|
785
|
+
md = require('marked');
|
786
|
+
} catch (err) {
|
787
|
+
throw new
|
788
|
+
Error('Cannot find markdown library, install markdown, discount, or marked.');
|
789
|
+
}
|
790
|
+
}
|
791
|
+
}
|
792
|
+
}
|
793
|
+
|
794
|
+
str = str.replace(/\\n/g, '\n');
|
795
|
+
return md.parse(str).replace(/\n/g, '\\n').replace(/'/g,''');
|
796
|
+
},
|
797
|
+
|
798
|
+
/**
|
799
|
+
* Transform coffeescript to javascript.
|
800
|
+
*/
|
801
|
+
|
802
|
+
coffeescript: function(str){
|
803
|
+
str = str.replace(/\\n/g, '\n');
|
804
|
+
var js = require('coffee-script').compile(str).replace(/\\/g, '\\\\').replace(/\n/g, '\\n');
|
805
|
+
return '<script type="text/javascript">\\n' + js + '</script>';
|
806
|
+
}
|
807
|
+
};
|
808
|
+
|
809
|
+
}); // module: filters.js
|
810
|
+
|
811
|
+
require.register("inline-tags.js", function(module, exports, require){
|
812
|
+
|
813
|
+
/*!
|
814
|
+
* Jade - inline tags
|
815
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
816
|
+
* MIT Licensed
|
817
|
+
*/
|
818
|
+
|
819
|
+
module.exports = [
|
820
|
+
'a'
|
821
|
+
, 'abbr'
|
822
|
+
, 'acronym'
|
823
|
+
, 'b'
|
824
|
+
, 'br'
|
825
|
+
, 'code'
|
826
|
+
, 'em'
|
827
|
+
, 'font'
|
828
|
+
, 'i'
|
829
|
+
, 'img'
|
830
|
+
, 'ins'
|
831
|
+
, 'kbd'
|
832
|
+
, 'map'
|
833
|
+
, 'samp'
|
834
|
+
, 'small'
|
835
|
+
, 'span'
|
836
|
+
, 'strong'
|
837
|
+
, 'sub'
|
838
|
+
, 'sup'
|
839
|
+
];
|
840
|
+
}); // module: inline-tags.js
|
841
|
+
|
842
|
+
require.register("jade.js", function(module, exports, require){
|
843
|
+
/*!
|
844
|
+
* Jade
|
845
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
846
|
+
* MIT Licensed
|
847
|
+
*/
|
848
|
+
|
849
|
+
/**
|
850
|
+
* Module dependencies.
|
851
|
+
*/
|
852
|
+
|
853
|
+
var Parser = require('./parser')
|
854
|
+
, Lexer = require('./lexer')
|
855
|
+
, Compiler = require('./compiler')
|
856
|
+
, runtime = require('./runtime')
|
857
|
+
|
858
|
+
/**
|
859
|
+
* Library version.
|
860
|
+
*/
|
861
|
+
|
862
|
+
exports.version = '0.26.1';
|
863
|
+
|
864
|
+
/**
|
865
|
+
* Expose self closing tags.
|
866
|
+
*/
|
867
|
+
|
868
|
+
exports.selfClosing = require('./self-closing');
|
869
|
+
|
870
|
+
/**
|
871
|
+
* Default supported doctypes.
|
872
|
+
*/
|
873
|
+
|
874
|
+
exports.doctypes = require('./doctypes');
|
875
|
+
|
876
|
+
/**
|
877
|
+
* Text filters.
|
878
|
+
*/
|
879
|
+
|
880
|
+
exports.filters = require('./filters');
|
881
|
+
|
882
|
+
/**
|
883
|
+
* Utilities.
|
884
|
+
*/
|
885
|
+
|
886
|
+
exports.utils = require('./utils');
|
887
|
+
|
888
|
+
/**
|
889
|
+
* Expose `Compiler`.
|
890
|
+
*/
|
891
|
+
|
892
|
+
exports.Compiler = Compiler;
|
893
|
+
|
894
|
+
/**
|
895
|
+
* Expose `Parser`.
|
896
|
+
*/
|
897
|
+
|
898
|
+
exports.Parser = Parser;
|
899
|
+
|
900
|
+
/**
|
901
|
+
* Expose `Lexer`.
|
902
|
+
*/
|
903
|
+
|
904
|
+
exports.Lexer = Lexer;
|
905
|
+
|
906
|
+
/**
|
907
|
+
* Nodes.
|
908
|
+
*/
|
909
|
+
|
910
|
+
exports.nodes = require('./nodes');
|
911
|
+
|
912
|
+
/**
|
913
|
+
* Jade runtime helpers.
|
914
|
+
*/
|
915
|
+
|
916
|
+
exports.runtime = runtime;
|
917
|
+
|
918
|
+
/**
|
919
|
+
* Template function cache.
|
920
|
+
*/
|
921
|
+
|
922
|
+
exports.cache = {};
|
923
|
+
|
924
|
+
/**
|
925
|
+
* Parse the given `str` of jade and return a function body.
|
926
|
+
*
|
927
|
+
* @param {String} str
|
928
|
+
* @param {Object} options
|
929
|
+
* @return {String}
|
930
|
+
* @api private
|
931
|
+
*/
|
932
|
+
|
933
|
+
function parse(str, options){
|
934
|
+
try {
|
935
|
+
// Parse
|
936
|
+
var parser = new Parser(str, options.filename, options);
|
937
|
+
|
938
|
+
// Compile
|
939
|
+
var compiler = new (options.compiler || Compiler)(parser.parse(), options)
|
940
|
+
, js = compiler.compile();
|
941
|
+
|
942
|
+
// Debug compiler
|
943
|
+
if (options.debug) {
|
944
|
+
console.error('\nCompiled Function:\n\n\033[90m%s\033[0m', js.replace(/^/gm, ' '));
|
945
|
+
}
|
946
|
+
|
947
|
+
return ''
|
948
|
+
+ 'var buf = [];\n'
|
949
|
+
+ (options.self
|
950
|
+
? 'var self = locals || {};\n' + js
|
951
|
+
: 'with (locals || {}) {\n' + js + '\n}\n')
|
952
|
+
+ 'return buf.join("");';
|
953
|
+
} catch (err) {
|
954
|
+
parser = parser.context();
|
955
|
+
runtime.rethrow(err, parser.filename, parser.lexer.lineno);
|
956
|
+
}
|
957
|
+
}
|
958
|
+
|
959
|
+
/**
|
960
|
+
* Compile a `Function` representation of the given jade `str`.
|
961
|
+
*
|
962
|
+
* Options:
|
963
|
+
*
|
964
|
+
* - `compileDebug` when `false` debugging code is stripped from the compiled template
|
965
|
+
* - `client` when `true` the helper functions `escape()` etc will reference `jade.escape()`
|
966
|
+
* for use with the Jade client-side runtime.js
|
967
|
+
*
|
968
|
+
* @param {String} str
|
969
|
+
* @param {Options} options
|
970
|
+
* @return {Function}
|
971
|
+
* @api public
|
972
|
+
*/
|
973
|
+
|
974
|
+
exports.compile = function(str, options){
|
975
|
+
var options = options || {}
|
976
|
+
, client = options.client
|
977
|
+
, filename = options.filename
|
978
|
+
? JSON.stringify(options.filename)
|
979
|
+
: 'undefined'
|
980
|
+
, fn;
|
981
|
+
|
982
|
+
if (options.compileDebug !== false) {
|
983
|
+
fn = [
|
984
|
+
'var __jade = [{ lineno: 1, filename: ' + filename + ' }];'
|
985
|
+
, 'try {'
|
986
|
+
, parse(String(str), options)
|
987
|
+
, '} catch (err) {'
|
988
|
+
, ' rethrow(err, __jade[0].filename, __jade[0].lineno);'
|
989
|
+
, '}'
|
990
|
+
].join('\n');
|
991
|
+
} else {
|
992
|
+
fn = parse(String(str), options);
|
993
|
+
}
|
994
|
+
|
995
|
+
if (client) {
|
996
|
+
fn = 'attrs = attrs || jade.attrs; escape = escape || jade.escape; rethrow = rethrow || jade.rethrow; merge = merge || jade.merge;\n' + fn;
|
997
|
+
}
|
998
|
+
|
999
|
+
fn = new Function('locals, attrs, escape, rethrow, merge', fn);
|
1000
|
+
|
1001
|
+
if (client) return fn;
|
1002
|
+
|
1003
|
+
return function(locals){
|
1004
|
+
return fn(locals, runtime.attrs, runtime.escape, runtime.rethrow, runtime.merge);
|
1005
|
+
};
|
1006
|
+
};
|
1007
|
+
|
1008
|
+
/**
|
1009
|
+
* Render the given `str` of jade and invoke
|
1010
|
+
* the callback `fn(err, str)`.
|
1011
|
+
*
|
1012
|
+
* Options:
|
1013
|
+
*
|
1014
|
+
* - `cache` enable template caching
|
1015
|
+
* - `filename` filename required for `include` / `extends` and caching
|
1016
|
+
*
|
1017
|
+
* @param {String} str
|
1018
|
+
* @param {Object|Function} options or fn
|
1019
|
+
* @param {Function} fn
|
1020
|
+
* @api public
|
1021
|
+
*/
|
1022
|
+
|
1023
|
+
exports.render = function(str, options, fn){
|
1024
|
+
// swap args
|
1025
|
+
if ('function' == typeof options) {
|
1026
|
+
fn = options, options = {};
|
1027
|
+
}
|
1028
|
+
|
1029
|
+
// cache requires .filename
|
1030
|
+
if (options.cache && !options.filename) {
|
1031
|
+
return fn(new Error('the "filename" option is required for caching'));
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
try {
|
1035
|
+
var path = options.filename;
|
1036
|
+
var tmpl = options.cache
|
1037
|
+
? exports.cache[path] || (exports.cache[path] = exports.compile(str, options))
|
1038
|
+
: exports.compile(str, options);
|
1039
|
+
fn(null, tmpl(options));
|
1040
|
+
} catch (err) {
|
1041
|
+
fn(err);
|
1042
|
+
}
|
1043
|
+
};
|
1044
|
+
|
1045
|
+
/**
|
1046
|
+
* Render a Jade file at the given `path` and callback `fn(err, str)`.
|
1047
|
+
*
|
1048
|
+
* @param {String} path
|
1049
|
+
* @param {Object|Function} options or callback
|
1050
|
+
* @param {Function} fn
|
1051
|
+
* @api public
|
1052
|
+
*/
|
1053
|
+
|
1054
|
+
exports.renderFile = function(path, options, fn){
|
1055
|
+
var key = path + ':string';
|
1056
|
+
|
1057
|
+
if ('function' == typeof options) {
|
1058
|
+
fn = options, options = {};
|
1059
|
+
}
|
1060
|
+
|
1061
|
+
try {
|
1062
|
+
options.filename = path;
|
1063
|
+
var str = options.cache
|
1064
|
+
? exports.cache[key] || (exports.cache[key] = fs.readFileSync(path, 'utf8'))
|
1065
|
+
: fs.readFileSync(path, 'utf8');
|
1066
|
+
exports.render(str, options, fn);
|
1067
|
+
} catch (err) {
|
1068
|
+
fn(err);
|
1069
|
+
}
|
1070
|
+
};
|
1071
|
+
|
1072
|
+
/**
|
1073
|
+
* Express support.
|
1074
|
+
*/
|
1075
|
+
|
1076
|
+
exports.__express = exports.renderFile;
|
1077
|
+
|
1078
|
+
}); // module: jade.js
|
1079
|
+
|
1080
|
+
require.register("lexer.js", function(module, exports, require){
|
1081
|
+
|
1082
|
+
/*!
|
1083
|
+
* Jade - Lexer
|
1084
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
1085
|
+
* MIT Licensed
|
1086
|
+
*/
|
1087
|
+
|
1088
|
+
/**
|
1089
|
+
* Initialize `Lexer` with the given `str`.
|
1090
|
+
*
|
1091
|
+
* Options:
|
1092
|
+
*
|
1093
|
+
* - `colons` allow colons for attr delimiters
|
1094
|
+
*
|
1095
|
+
* @param {String} str
|
1096
|
+
* @param {Object} options
|
1097
|
+
* @api private
|
1098
|
+
*/
|
1099
|
+
|
1100
|
+
var Lexer = module.exports = function Lexer(str, options) {
|
1101
|
+
options = options || {};
|
1102
|
+
this.input = str.replace(/\r\n|\r/g, '\n');
|
1103
|
+
this.colons = options.colons;
|
1104
|
+
this.deferredTokens = [];
|
1105
|
+
this.lastIndents = 0;
|
1106
|
+
this.lineno = 1;
|
1107
|
+
this.stash = [];
|
1108
|
+
this.indentStack = [];
|
1109
|
+
this.indentRe = null;
|
1110
|
+
this.pipeless = false;
|
1111
|
+
};
|
1112
|
+
|
1113
|
+
/**
|
1114
|
+
* Lexer prototype.
|
1115
|
+
*/
|
1116
|
+
|
1117
|
+
Lexer.prototype = {
|
1118
|
+
|
1119
|
+
/**
|
1120
|
+
* Construct a token with the given `type` and `val`.
|
1121
|
+
*
|
1122
|
+
* @param {String} type
|
1123
|
+
* @param {String} val
|
1124
|
+
* @return {Object}
|
1125
|
+
* @api private
|
1126
|
+
*/
|
1127
|
+
|
1128
|
+
tok: function(type, val){
|
1129
|
+
return {
|
1130
|
+
type: type
|
1131
|
+
, line: this.lineno
|
1132
|
+
, val: val
|
1133
|
+
}
|
1134
|
+
},
|
1135
|
+
|
1136
|
+
/**
|
1137
|
+
* Consume the given `len` of input.
|
1138
|
+
*
|
1139
|
+
* @param {Number} len
|
1140
|
+
* @api private
|
1141
|
+
*/
|
1142
|
+
|
1143
|
+
consume: function(len){
|
1144
|
+
this.input = this.input.substr(len);
|
1145
|
+
},
|
1146
|
+
|
1147
|
+
/**
|
1148
|
+
* Scan for `type` with the given `regexp`.
|
1149
|
+
*
|
1150
|
+
* @param {String} type
|
1151
|
+
* @param {RegExp} regexp
|
1152
|
+
* @return {Object}
|
1153
|
+
* @api private
|
1154
|
+
*/
|
1155
|
+
|
1156
|
+
scan: function(regexp, type){
|
1157
|
+
var captures;
|
1158
|
+
if (captures = regexp.exec(this.input)) {
|
1159
|
+
this.consume(captures[0].length);
|
1160
|
+
return this.tok(type, captures[1]);
|
1161
|
+
}
|
1162
|
+
},
|
1163
|
+
|
1164
|
+
/**
|
1165
|
+
* Defer the given `tok`.
|
1166
|
+
*
|
1167
|
+
* @param {Object} tok
|
1168
|
+
* @api private
|
1169
|
+
*/
|
1170
|
+
|
1171
|
+
defer: function(tok){
|
1172
|
+
this.deferredTokens.push(tok);
|
1173
|
+
},
|
1174
|
+
|
1175
|
+
/**
|
1176
|
+
* Lookahead `n` tokens.
|
1177
|
+
*
|
1178
|
+
* @param {Number} n
|
1179
|
+
* @return {Object}
|
1180
|
+
* @api private
|
1181
|
+
*/
|
1182
|
+
|
1183
|
+
lookahead: function(n){
|
1184
|
+
var fetch = n - this.stash.length;
|
1185
|
+
while (fetch-- > 0) this.stash.push(this.next());
|
1186
|
+
return this.stash[--n];
|
1187
|
+
},
|
1188
|
+
|
1189
|
+
/**
|
1190
|
+
* Return the indexOf `start` / `end` delimiters.
|
1191
|
+
*
|
1192
|
+
* @param {String} start
|
1193
|
+
* @param {String} end
|
1194
|
+
* @return {Number}
|
1195
|
+
* @api private
|
1196
|
+
*/
|
1197
|
+
|
1198
|
+
indexOfDelimiters: function(start, end){
|
1199
|
+
var str = this.input
|
1200
|
+
, nstart = 0
|
1201
|
+
, nend = 0
|
1202
|
+
, pos = 0;
|
1203
|
+
for (var i = 0, len = str.length; i < len; ++i) {
|
1204
|
+
if (start == str.charAt(i)) {
|
1205
|
+
++nstart;
|
1206
|
+
} else if (end == str.charAt(i)) {
|
1207
|
+
if (++nend == nstart) {
|
1208
|
+
pos = i;
|
1209
|
+
break;
|
1210
|
+
}
|
1211
|
+
}
|
1212
|
+
}
|
1213
|
+
return pos;
|
1214
|
+
},
|
1215
|
+
|
1216
|
+
/**
|
1217
|
+
* Stashed token.
|
1218
|
+
*/
|
1219
|
+
|
1220
|
+
stashed: function() {
|
1221
|
+
return this.stash.length
|
1222
|
+
&& this.stash.shift();
|
1223
|
+
},
|
1224
|
+
|
1225
|
+
/**
|
1226
|
+
* Deferred token.
|
1227
|
+
*/
|
1228
|
+
|
1229
|
+
deferred: function() {
|
1230
|
+
return this.deferredTokens.length
|
1231
|
+
&& this.deferredTokens.shift();
|
1232
|
+
},
|
1233
|
+
|
1234
|
+
/**
|
1235
|
+
* end-of-source.
|
1236
|
+
*/
|
1237
|
+
|
1238
|
+
eos: function() {
|
1239
|
+
if (this.input.length) return;
|
1240
|
+
if (this.indentStack.length) {
|
1241
|
+
this.indentStack.shift();
|
1242
|
+
return this.tok('outdent');
|
1243
|
+
} else {
|
1244
|
+
return this.tok('eos');
|
1245
|
+
}
|
1246
|
+
},
|
1247
|
+
|
1248
|
+
/**
|
1249
|
+
* Blank line.
|
1250
|
+
*/
|
1251
|
+
|
1252
|
+
blank: function() {
|
1253
|
+
var captures;
|
1254
|
+
if (captures = /^\n *\n/.exec(this.input)) {
|
1255
|
+
this.consume(captures[0].length - 1);
|
1256
|
+
if (this.pipeless) return this.tok('text', '');
|
1257
|
+
return this.next();
|
1258
|
+
}
|
1259
|
+
},
|
1260
|
+
|
1261
|
+
/**
|
1262
|
+
* Comment.
|
1263
|
+
*/
|
1264
|
+
|
1265
|
+
comment: function() {
|
1266
|
+
var captures;
|
1267
|
+
if (captures = /^ *\/\/(-)?([^\n]*)/.exec(this.input)) {
|
1268
|
+
this.consume(captures[0].length);
|
1269
|
+
var tok = this.tok('comment', captures[2]);
|
1270
|
+
tok.buffer = '-' != captures[1];
|
1271
|
+
return tok;
|
1272
|
+
}
|
1273
|
+
},
|
1274
|
+
|
1275
|
+
/**
|
1276
|
+
* Interpolated tag.
|
1277
|
+
*/
|
1278
|
+
|
1279
|
+
interpolation: function() {
|
1280
|
+
var captures;
|
1281
|
+
if (captures = /^#\{(.*?)\}/.exec(this.input)) {
|
1282
|
+
this.consume(captures[0].length);
|
1283
|
+
return this.tok('interpolation', captures[1]);
|
1284
|
+
}
|
1285
|
+
},
|
1286
|
+
|
1287
|
+
/**
|
1288
|
+
* Tag.
|
1289
|
+
*/
|
1290
|
+
|
1291
|
+
tag: function() {
|
1292
|
+
var captures;
|
1293
|
+
if (captures = /^(\w[-:\w]*)(\/?)/.exec(this.input)) {
|
1294
|
+
this.consume(captures[0].length);
|
1295
|
+
var tok, name = captures[1];
|
1296
|
+
if (':' == name[name.length - 1]) {
|
1297
|
+
name = name.slice(0, -1);
|
1298
|
+
tok = this.tok('tag', name);
|
1299
|
+
this.defer(this.tok(':'));
|
1300
|
+
while (' ' == this.input[0]) this.input = this.input.substr(1);
|
1301
|
+
} else {
|
1302
|
+
tok = this.tok('tag', name);
|
1303
|
+
}
|
1304
|
+
tok.selfClosing = !! captures[2];
|
1305
|
+
return tok;
|
1306
|
+
}
|
1307
|
+
},
|
1308
|
+
|
1309
|
+
/**
|
1310
|
+
* Filter.
|
1311
|
+
*/
|
1312
|
+
|
1313
|
+
filter: function() {
|
1314
|
+
return this.scan(/^:(\w+)/, 'filter');
|
1315
|
+
},
|
1316
|
+
|
1317
|
+
/**
|
1318
|
+
* Doctype.
|
1319
|
+
*/
|
1320
|
+
|
1321
|
+
doctype: function() {
|
1322
|
+
return this.scan(/^(?:!!!|doctype) *([^\n]+)?/, 'doctype');
|
1323
|
+
},
|
1324
|
+
|
1325
|
+
/**
|
1326
|
+
* Id.
|
1327
|
+
*/
|
1328
|
+
|
1329
|
+
id: function() {
|
1330
|
+
return this.scan(/^#([\w-]+)/, 'id');
|
1331
|
+
},
|
1332
|
+
|
1333
|
+
/**
|
1334
|
+
* Class.
|
1335
|
+
*/
|
1336
|
+
|
1337
|
+
className: function() {
|
1338
|
+
return this.scan(/^\.([\w-]+)/, 'class');
|
1339
|
+
},
|
1340
|
+
|
1341
|
+
/**
|
1342
|
+
* Text.
|
1343
|
+
*/
|
1344
|
+
|
1345
|
+
text: function() {
|
1346
|
+
return this.scan(/^(?:\| ?| ?)?([^\n]+)/, 'text');
|
1347
|
+
},
|
1348
|
+
|
1349
|
+
/**
|
1350
|
+
* Extends.
|
1351
|
+
*/
|
1352
|
+
|
1353
|
+
"extends": function() {
|
1354
|
+
return this.scan(/^extends? +([^\n]+)/, 'extends');
|
1355
|
+
},
|
1356
|
+
|
1357
|
+
/**
|
1358
|
+
* Block prepend.
|
1359
|
+
*/
|
1360
|
+
|
1361
|
+
prepend: function() {
|
1362
|
+
var captures;
|
1363
|
+
if (captures = /^prepend +([^\n]+)/.exec(this.input)) {
|
1364
|
+
this.consume(captures[0].length);
|
1365
|
+
var mode = 'prepend'
|
1366
|
+
, name = captures[1]
|
1367
|
+
, tok = this.tok('block', name);
|
1368
|
+
tok.mode = mode;
|
1369
|
+
return tok;
|
1370
|
+
}
|
1371
|
+
},
|
1372
|
+
|
1373
|
+
/**
|
1374
|
+
* Block append.
|
1375
|
+
*/
|
1376
|
+
|
1377
|
+
append: function() {
|
1378
|
+
var captures;
|
1379
|
+
if (captures = /^append +([^\n]+)/.exec(this.input)) {
|
1380
|
+
this.consume(captures[0].length);
|
1381
|
+
var mode = 'append'
|
1382
|
+
, name = captures[1]
|
1383
|
+
, tok = this.tok('block', name);
|
1384
|
+
tok.mode = mode;
|
1385
|
+
return tok;
|
1386
|
+
}
|
1387
|
+
},
|
1388
|
+
|
1389
|
+
/**
|
1390
|
+
* Block.
|
1391
|
+
*/
|
1392
|
+
|
1393
|
+
block: function() {
|
1394
|
+
var captures;
|
1395
|
+
if (captures = /^block\b *(?:(prepend|append) +)?([^\n]*)/.exec(this.input)) {
|
1396
|
+
this.consume(captures[0].length);
|
1397
|
+
var mode = captures[1] || 'replace'
|
1398
|
+
, name = captures[2]
|
1399
|
+
, tok = this.tok('block', name);
|
1400
|
+
|
1401
|
+
tok.mode = mode;
|
1402
|
+
return tok;
|
1403
|
+
}
|
1404
|
+
},
|
1405
|
+
|
1406
|
+
/**
|
1407
|
+
* Yield.
|
1408
|
+
*/
|
1409
|
+
|
1410
|
+
yield: function() {
|
1411
|
+
return this.scan(/^yield */, 'yield');
|
1412
|
+
},
|
1413
|
+
|
1414
|
+
/**
|
1415
|
+
* Include.
|
1416
|
+
*/
|
1417
|
+
|
1418
|
+
include: function() {
|
1419
|
+
return this.scan(/^include +([^\n]+)/, 'include');
|
1420
|
+
},
|
1421
|
+
|
1422
|
+
/**
|
1423
|
+
* Case.
|
1424
|
+
*/
|
1425
|
+
|
1426
|
+
"case": function() {
|
1427
|
+
return this.scan(/^case +([^\n]+)/, 'case');
|
1428
|
+
},
|
1429
|
+
|
1430
|
+
/**
|
1431
|
+
* When.
|
1432
|
+
*/
|
1433
|
+
|
1434
|
+
when: function() {
|
1435
|
+
return this.scan(/^when +([^:\n]+)/, 'when');
|
1436
|
+
},
|
1437
|
+
|
1438
|
+
/**
|
1439
|
+
* Default.
|
1440
|
+
*/
|
1441
|
+
|
1442
|
+
"default": function() {
|
1443
|
+
return this.scan(/^default */, 'default');
|
1444
|
+
},
|
1445
|
+
|
1446
|
+
/**
|
1447
|
+
* Assignment.
|
1448
|
+
*/
|
1449
|
+
|
1450
|
+
assignment: function() {
|
1451
|
+
var captures;
|
1452
|
+
if (captures = /^(\w+) += *([^;\n]+)( *;? *)/.exec(this.input)) {
|
1453
|
+
this.consume(captures[0].length);
|
1454
|
+
var name = captures[1]
|
1455
|
+
, val = captures[2];
|
1456
|
+
return this.tok('code', 'var ' + name + ' = (' + val + ');');
|
1457
|
+
}
|
1458
|
+
},
|
1459
|
+
|
1460
|
+
/**
|
1461
|
+
* Call mixin.
|
1462
|
+
*/
|
1463
|
+
|
1464
|
+
call: function(){
|
1465
|
+
var captures;
|
1466
|
+
if (captures = /^\+([-\w]+)/.exec(this.input)) {
|
1467
|
+
this.consume(captures[0].length);
|
1468
|
+
var tok = this.tok('call', captures[1]);
|
1469
|
+
|
1470
|
+
// Check for args (not attributes)
|
1471
|
+
if (captures = /^ *\((.*?)\)/.exec(this.input)) {
|
1472
|
+
if (!/^ *[-\w]+ *=/.test(captures[1])) {
|
1473
|
+
this.consume(captures[0].length);
|
1474
|
+
tok.args = captures[1];
|
1475
|
+
}
|
1476
|
+
}
|
1477
|
+
|
1478
|
+
return tok;
|
1479
|
+
}
|
1480
|
+
},
|
1481
|
+
|
1482
|
+
/**
|
1483
|
+
* Mixin.
|
1484
|
+
*/
|
1485
|
+
|
1486
|
+
mixin: function(){
|
1487
|
+
var captures;
|
1488
|
+
if (captures = /^mixin +([-\w]+)(?: *\((.*)\))?/.exec(this.input)) {
|
1489
|
+
this.consume(captures[0].length);
|
1490
|
+
var tok = this.tok('mixin', captures[1]);
|
1491
|
+
tok.args = captures[2];
|
1492
|
+
return tok;
|
1493
|
+
}
|
1494
|
+
},
|
1495
|
+
|
1496
|
+
/**
|
1497
|
+
* Conditional.
|
1498
|
+
*/
|
1499
|
+
|
1500
|
+
conditional: function() {
|
1501
|
+
var captures;
|
1502
|
+
if (captures = /^(if|unless|else if|else)\b([^\n]*)/.exec(this.input)) {
|
1503
|
+
this.consume(captures[0].length);
|
1504
|
+
var type = captures[1]
|
1505
|
+
, js = captures[2];
|
1506
|
+
|
1507
|
+
switch (type) {
|
1508
|
+
case 'if': js = 'if (' + js + ')'; break;
|
1509
|
+
case 'unless': js = 'if (!(' + js + '))'; break;
|
1510
|
+
case 'else if': js = 'else if (' + js + ')'; break;
|
1511
|
+
case 'else': js = 'else'; break;
|
1512
|
+
}
|
1513
|
+
|
1514
|
+
return this.tok('code', js);
|
1515
|
+
}
|
1516
|
+
},
|
1517
|
+
|
1518
|
+
/**
|
1519
|
+
* While.
|
1520
|
+
*/
|
1521
|
+
|
1522
|
+
"while": function() {
|
1523
|
+
var captures;
|
1524
|
+
if (captures = /^while +([^\n]+)/.exec(this.input)) {
|
1525
|
+
this.consume(captures[0].length);
|
1526
|
+
return this.tok('code', 'while (' + captures[1] + ')');
|
1527
|
+
}
|
1528
|
+
},
|
1529
|
+
|
1530
|
+
/**
|
1531
|
+
* Each.
|
1532
|
+
*/
|
1533
|
+
|
1534
|
+
each: function() {
|
1535
|
+
var captures;
|
1536
|
+
if (captures = /^(?:- *)?(?:each|for) +(\w+)(?: *, *(\w+))? * in *([^\n]+)/.exec(this.input)) {
|
1537
|
+
this.consume(captures[0].length);
|
1538
|
+
var tok = this.tok('each', captures[1]);
|
1539
|
+
tok.key = captures[2] || '$index';
|
1540
|
+
tok.code = captures[3];
|
1541
|
+
return tok;
|
1542
|
+
}
|
1543
|
+
},
|
1544
|
+
|
1545
|
+
/**
|
1546
|
+
* Code.
|
1547
|
+
*/
|
1548
|
+
|
1549
|
+
code: function() {
|
1550
|
+
var captures;
|
1551
|
+
if (captures = /^(!?=|-)([^\n]+)/.exec(this.input)) {
|
1552
|
+
this.consume(captures[0].length);
|
1553
|
+
var flags = captures[1];
|
1554
|
+
captures[1] = captures[2];
|
1555
|
+
var tok = this.tok('code', captures[1]);
|
1556
|
+
tok.escape = flags[0] === '=';
|
1557
|
+
tok.buffer = flags[0] === '=' || flags[1] === '=';
|
1558
|
+
return tok;
|
1559
|
+
}
|
1560
|
+
},
|
1561
|
+
|
1562
|
+
/**
|
1563
|
+
* Attributes.
|
1564
|
+
*/
|
1565
|
+
|
1566
|
+
attrs: function() {
|
1567
|
+
if ('(' == this.input.charAt(0)) {
|
1568
|
+
var index = this.indexOfDelimiters('(', ')')
|
1569
|
+
, str = this.input.substr(1, index-1)
|
1570
|
+
, tok = this.tok('attrs')
|
1571
|
+
, len = str.length
|
1572
|
+
, colons = this.colons
|
1573
|
+
, states = ['key']
|
1574
|
+
, escapedAttr
|
1575
|
+
, key = ''
|
1576
|
+
, val = ''
|
1577
|
+
, quote
|
1578
|
+
, c
|
1579
|
+
, p;
|
1580
|
+
|
1581
|
+
function state(){
|
1582
|
+
return states[states.length - 1];
|
1583
|
+
}
|
1584
|
+
|
1585
|
+
function interpolate(attr) {
|
1586
|
+
return attr.replace(/#\{([^}]+)\}/g, function(_, expr){
|
1587
|
+
return quote + " + (" + expr + ") + " + quote;
|
1588
|
+
});
|
1589
|
+
}
|
1590
|
+
|
1591
|
+
this.consume(index + 1);
|
1592
|
+
tok.attrs = {};
|
1593
|
+
tok.escaped = {};
|
1594
|
+
|
1595
|
+
function parse(c) {
|
1596
|
+
var real = c;
|
1597
|
+
// TODO: remove when people fix ":"
|
1598
|
+
if (colons && ':' == c) c = '=';
|
1599
|
+
switch (c) {
|
1600
|
+
case ',':
|
1601
|
+
case '\n':
|
1602
|
+
switch (state()) {
|
1603
|
+
case 'expr':
|
1604
|
+
case 'array':
|
1605
|
+
case 'string':
|
1606
|
+
case 'object':
|
1607
|
+
val += c;
|
1608
|
+
break;
|
1609
|
+
default:
|
1610
|
+
states.push('key');
|
1611
|
+
val = val.trim();
|
1612
|
+
key = key.trim();
|
1613
|
+
if ('' == key) return;
|
1614
|
+
key = key.replace(/^['"]|['"]$/g, '').replace('!', '');
|
1615
|
+
tok.escaped[key] = escapedAttr;
|
1616
|
+
tok.attrs[key] = '' == val
|
1617
|
+
? true
|
1618
|
+
: interpolate(val);
|
1619
|
+
key = val = '';
|
1620
|
+
}
|
1621
|
+
break;
|
1622
|
+
case '=':
|
1623
|
+
switch (state()) {
|
1624
|
+
case 'key char':
|
1625
|
+
key += real;
|
1626
|
+
break;
|
1627
|
+
case 'val':
|
1628
|
+
case 'expr':
|
1629
|
+
case 'array':
|
1630
|
+
case 'string':
|
1631
|
+
case 'object':
|
1632
|
+
val += real;
|
1633
|
+
break;
|
1634
|
+
default:
|
1635
|
+
escapedAttr = '!' != p;
|
1636
|
+
states.push('val');
|
1637
|
+
}
|
1638
|
+
break;
|
1639
|
+
case '(':
|
1640
|
+
if ('val' == state()
|
1641
|
+
|| 'expr' == state()) states.push('expr');
|
1642
|
+
val += c;
|
1643
|
+
break;
|
1644
|
+
case ')':
|
1645
|
+
if ('expr' == state()
|
1646
|
+
|| 'val' == state()) states.pop();
|
1647
|
+
val += c;
|
1648
|
+
break;
|
1649
|
+
case '{':
|
1650
|
+
if ('val' == state()) states.push('object');
|
1651
|
+
val += c;
|
1652
|
+
break;
|
1653
|
+
case '}':
|
1654
|
+
if ('object' == state()) states.pop();
|
1655
|
+
val += c;
|
1656
|
+
break;
|
1657
|
+
case '[':
|
1658
|
+
if ('val' == state()) states.push('array');
|
1659
|
+
val += c;
|
1660
|
+
break;
|
1661
|
+
case ']':
|
1662
|
+
if ('array' == state()) states.pop();
|
1663
|
+
val += c;
|
1664
|
+
break;
|
1665
|
+
case '"':
|
1666
|
+
case "'":
|
1667
|
+
switch (state()) {
|
1668
|
+
case 'key':
|
1669
|
+
states.push('key char');
|
1670
|
+
break;
|
1671
|
+
case 'key char':
|
1672
|
+
states.pop();
|
1673
|
+
break;
|
1674
|
+
case 'string':
|
1675
|
+
if (c == quote) states.pop();
|
1676
|
+
val += c;
|
1677
|
+
break;
|
1678
|
+
default:
|
1679
|
+
states.push('string');
|
1680
|
+
val += c;
|
1681
|
+
quote = c;
|
1682
|
+
}
|
1683
|
+
break;
|
1684
|
+
case '':
|
1685
|
+
break;
|
1686
|
+
default:
|
1687
|
+
switch (state()) {
|
1688
|
+
case 'key':
|
1689
|
+
case 'key char':
|
1690
|
+
key += c;
|
1691
|
+
break;
|
1692
|
+
default:
|
1693
|
+
val += c;
|
1694
|
+
}
|
1695
|
+
}
|
1696
|
+
p = c;
|
1697
|
+
}
|
1698
|
+
|
1699
|
+
for (var i = 0; i < len; ++i) {
|
1700
|
+
parse(str.charAt(i));
|
1701
|
+
}
|
1702
|
+
|
1703
|
+
parse(',');
|
1704
|
+
|
1705
|
+
if ('/' == this.input.charAt(0)) {
|
1706
|
+
this.consume(1);
|
1707
|
+
tok.selfClosing = true;
|
1708
|
+
}
|
1709
|
+
|
1710
|
+
return tok;
|
1711
|
+
}
|
1712
|
+
},
|
1713
|
+
|
1714
|
+
/**
|
1715
|
+
* Indent | Outdent | Newline.
|
1716
|
+
*/
|
1717
|
+
|
1718
|
+
indent: function() {
|
1719
|
+
var captures, re;
|
1720
|
+
|
1721
|
+
// established regexp
|
1722
|
+
if (this.indentRe) {
|
1723
|
+
captures = this.indentRe.exec(this.input);
|
1724
|
+
// determine regexp
|
1725
|
+
} else {
|
1726
|
+
// tabs
|
1727
|
+
re = /^\n(\t*) */;
|
1728
|
+
captures = re.exec(this.input);
|
1729
|
+
|
1730
|
+
// spaces
|
1731
|
+
if (captures && !captures[1].length) {
|
1732
|
+
re = /^\n( *)/;
|
1733
|
+
captures = re.exec(this.input);
|
1734
|
+
}
|
1735
|
+
|
1736
|
+
// established
|
1737
|
+
if (captures && captures[1].length) this.indentRe = re;
|
1738
|
+
}
|
1739
|
+
|
1740
|
+
if (captures) {
|
1741
|
+
var tok
|
1742
|
+
, indents = captures[1].length;
|
1743
|
+
|
1744
|
+
++this.lineno;
|
1745
|
+
this.consume(indents + 1);
|
1746
|
+
|
1747
|
+
if (' ' == this.input[0] || '\t' == this.input[0]) {
|
1748
|
+
throw new Error('Invalid indentation, you can use tabs or spaces but not both');
|
1749
|
+
}
|
1750
|
+
|
1751
|
+
// blank line
|
1752
|
+
if ('\n' == this.input[0]) return this.tok('newline');
|
1753
|
+
|
1754
|
+
// outdent
|
1755
|
+
if (this.indentStack.length && indents < this.indentStack[0]) {
|
1756
|
+
while (this.indentStack.length && this.indentStack[0] > indents) {
|
1757
|
+
this.stash.push(this.tok('outdent'));
|
1758
|
+
this.indentStack.shift();
|
1759
|
+
}
|
1760
|
+
tok = this.stash.pop();
|
1761
|
+
// indent
|
1762
|
+
} else if (indents && indents != this.indentStack[0]) {
|
1763
|
+
this.indentStack.unshift(indents);
|
1764
|
+
tok = this.tok('indent', indents);
|
1765
|
+
// newline
|
1766
|
+
} else {
|
1767
|
+
tok = this.tok('newline');
|
1768
|
+
}
|
1769
|
+
|
1770
|
+
return tok;
|
1771
|
+
}
|
1772
|
+
},
|
1773
|
+
|
1774
|
+
/**
|
1775
|
+
* Pipe-less text consumed only when
|
1776
|
+
* pipeless is true;
|
1777
|
+
*/
|
1778
|
+
|
1779
|
+
pipelessText: function() {
|
1780
|
+
if (this.pipeless) {
|
1781
|
+
if ('\n' == this.input[0]) return;
|
1782
|
+
var i = this.input.indexOf('\n');
|
1783
|
+
if (-1 == i) i = this.input.length;
|
1784
|
+
var str = this.input.substr(0, i);
|
1785
|
+
this.consume(str.length);
|
1786
|
+
return this.tok('text', str);
|
1787
|
+
}
|
1788
|
+
},
|
1789
|
+
|
1790
|
+
/**
|
1791
|
+
* ':'
|
1792
|
+
*/
|
1793
|
+
|
1794
|
+
colon: function() {
|
1795
|
+
return this.scan(/^: */, ':');
|
1796
|
+
},
|
1797
|
+
|
1798
|
+
/**
|
1799
|
+
* Return the next token object, or those
|
1800
|
+
* previously stashed by lookahead.
|
1801
|
+
*
|
1802
|
+
* @return {Object}
|
1803
|
+
* @api private
|
1804
|
+
*/
|
1805
|
+
|
1806
|
+
advance: function(){
|
1807
|
+
return this.stashed()
|
1808
|
+
|| this.next();
|
1809
|
+
},
|
1810
|
+
|
1811
|
+
/**
|
1812
|
+
* Return the next token object.
|
1813
|
+
*
|
1814
|
+
* @return {Object}
|
1815
|
+
* @api private
|
1816
|
+
*/
|
1817
|
+
|
1818
|
+
next: function() {
|
1819
|
+
return this.deferred()
|
1820
|
+
|| this.blank()
|
1821
|
+
|| this.eos()
|
1822
|
+
|| this.pipelessText()
|
1823
|
+
|| this.yield()
|
1824
|
+
|| this.doctype()
|
1825
|
+
|| this.interpolation()
|
1826
|
+
|| this["case"]()
|
1827
|
+
|| this.when()
|
1828
|
+
|| this["default"]()
|
1829
|
+
|| this["extends"]()
|
1830
|
+
|| this.append()
|
1831
|
+
|| this.prepend()
|
1832
|
+
|| this.block()
|
1833
|
+
|| this.include()
|
1834
|
+
|| this.mixin()
|
1835
|
+
|| this.call()
|
1836
|
+
|| this.conditional()
|
1837
|
+
|| this.each()
|
1838
|
+
|| this["while"]()
|
1839
|
+
|| this.assignment()
|
1840
|
+
|| this.tag()
|
1841
|
+
|| this.filter()
|
1842
|
+
|| this.code()
|
1843
|
+
|| this.id()
|
1844
|
+
|| this.className()
|
1845
|
+
|| this.attrs()
|
1846
|
+
|| this.indent()
|
1847
|
+
|| this.comment()
|
1848
|
+
|| this.colon()
|
1849
|
+
|| this.text();
|
1850
|
+
}
|
1851
|
+
};
|
1852
|
+
|
1853
|
+
}); // module: lexer.js
|
1854
|
+
|
1855
|
+
require.register("nodes/attrs.js", function(module, exports, require){
|
1856
|
+
|
1857
|
+
/*!
|
1858
|
+
* Jade - nodes - Attrs
|
1859
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
1860
|
+
* MIT Licensed
|
1861
|
+
*/
|
1862
|
+
|
1863
|
+
/**
|
1864
|
+
* Module dependencies.
|
1865
|
+
*/
|
1866
|
+
|
1867
|
+
var Node = require('./node'),
|
1868
|
+
Block = require('./block');
|
1869
|
+
|
1870
|
+
/**
|
1871
|
+
* Initialize a `Attrs` node.
|
1872
|
+
*
|
1873
|
+
* @api public
|
1874
|
+
*/
|
1875
|
+
|
1876
|
+
var Attrs = module.exports = function Attrs() {
|
1877
|
+
this.attrs = [];
|
1878
|
+
};
|
1879
|
+
|
1880
|
+
/**
|
1881
|
+
* Inherit from `Node`.
|
1882
|
+
*/
|
1883
|
+
|
1884
|
+
Attrs.prototype = new Node;
|
1885
|
+
Attrs.prototype.constructor = Attrs;
|
1886
|
+
|
1887
|
+
|
1888
|
+
/**
|
1889
|
+
* Set attribute `name` to `val`, keep in mind these become
|
1890
|
+
* part of a raw js object literal, so to quote a value you must
|
1891
|
+
* '"quote me"', otherwise or example 'user.name' is literal JavaScript.
|
1892
|
+
*
|
1893
|
+
* @param {String} name
|
1894
|
+
* @param {String} val
|
1895
|
+
* @param {Boolean} escaped
|
1896
|
+
* @return {Tag} for chaining
|
1897
|
+
* @api public
|
1898
|
+
*/
|
1899
|
+
|
1900
|
+
Attrs.prototype.setAttribute = function(name, val, escaped){
|
1901
|
+
this.attrs.push({ name: name, val: val, escaped: escaped });
|
1902
|
+
return this;
|
1903
|
+
};
|
1904
|
+
|
1905
|
+
/**
|
1906
|
+
* Remove attribute `name` when present.
|
1907
|
+
*
|
1908
|
+
* @param {String} name
|
1909
|
+
* @api public
|
1910
|
+
*/
|
1911
|
+
|
1912
|
+
Attrs.prototype.removeAttribute = function(name){
|
1913
|
+
for (var i = 0, len = this.attrs.length; i < len; ++i) {
|
1914
|
+
if (this.attrs[i] && this.attrs[i].name == name) {
|
1915
|
+
delete this.attrs[i];
|
1916
|
+
}
|
1917
|
+
}
|
1918
|
+
};
|
1919
|
+
|
1920
|
+
/**
|
1921
|
+
* Get attribute value by `name`.
|
1922
|
+
*
|
1923
|
+
* @param {String} name
|
1924
|
+
* @return {String}
|
1925
|
+
* @api public
|
1926
|
+
*/
|
1927
|
+
|
1928
|
+
Attrs.prototype.getAttribute = function(name){
|
1929
|
+
for (var i = 0, len = this.attrs.length; i < len; ++i) {
|
1930
|
+
if (this.attrs[i] && this.attrs[i].name == name) {
|
1931
|
+
return this.attrs[i].val;
|
1932
|
+
}
|
1933
|
+
}
|
1934
|
+
};
|
1935
|
+
|
1936
|
+
}); // module: nodes/attrs.js
|
1937
|
+
|
1938
|
+
require.register("nodes/block-comment.js", function(module, exports, require){
|
1939
|
+
|
1940
|
+
/*!
|
1941
|
+
* Jade - nodes - BlockComment
|
1942
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
1943
|
+
* MIT Licensed
|
1944
|
+
*/
|
1945
|
+
|
1946
|
+
/**
|
1947
|
+
* Module dependencies.
|
1948
|
+
*/
|
1949
|
+
|
1950
|
+
var Node = require('./node');
|
1951
|
+
|
1952
|
+
/**
|
1953
|
+
* Initialize a `BlockComment` with the given `block`.
|
1954
|
+
*
|
1955
|
+
* @param {String} val
|
1956
|
+
* @param {Block} block
|
1957
|
+
* @param {Boolean} buffer
|
1958
|
+
* @api public
|
1959
|
+
*/
|
1960
|
+
|
1961
|
+
var BlockComment = module.exports = function BlockComment(val, block, buffer) {
|
1962
|
+
this.block = block;
|
1963
|
+
this.val = val;
|
1964
|
+
this.buffer = buffer;
|
1965
|
+
};
|
1966
|
+
|
1967
|
+
/**
|
1968
|
+
* Inherit from `Node`.
|
1969
|
+
*/
|
1970
|
+
|
1971
|
+
BlockComment.prototype = new Node;
|
1972
|
+
BlockComment.prototype.constructor = BlockComment;
|
1973
|
+
|
1974
|
+
}); // module: nodes/block-comment.js
|
1975
|
+
|
1976
|
+
require.register("nodes/block.js", function(module, exports, require){
|
1977
|
+
|
1978
|
+
/*!
|
1979
|
+
* Jade - nodes - Block
|
1980
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
1981
|
+
* MIT Licensed
|
1982
|
+
*/
|
1983
|
+
|
1984
|
+
/**
|
1985
|
+
* Module dependencies.
|
1986
|
+
*/
|
1987
|
+
|
1988
|
+
var Node = require('./node');
|
1989
|
+
|
1990
|
+
/**
|
1991
|
+
* Initialize a new `Block` with an optional `node`.
|
1992
|
+
*
|
1993
|
+
* @param {Node} node
|
1994
|
+
* @api public
|
1995
|
+
*/
|
1996
|
+
|
1997
|
+
var Block = module.exports = function Block(node){
|
1998
|
+
this.nodes = [];
|
1999
|
+
if (node) this.push(node);
|
2000
|
+
};
|
2001
|
+
|
2002
|
+
/**
|
2003
|
+
* Inherit from `Node`.
|
2004
|
+
*/
|
2005
|
+
|
2006
|
+
Block.prototype = new Node;
|
2007
|
+
Block.prototype.constructor = Block;
|
2008
|
+
|
2009
|
+
|
2010
|
+
/**
|
2011
|
+
* Block flag.
|
2012
|
+
*/
|
2013
|
+
|
2014
|
+
Block.prototype.isBlock = true;
|
2015
|
+
|
2016
|
+
/**
|
2017
|
+
* Replace the nodes in `other` with the nodes
|
2018
|
+
* in `this` block.
|
2019
|
+
*
|
2020
|
+
* @param {Block} other
|
2021
|
+
* @api private
|
2022
|
+
*/
|
2023
|
+
|
2024
|
+
Block.prototype.replace = function(other){
|
2025
|
+
other.nodes = this.nodes;
|
2026
|
+
};
|
2027
|
+
|
2028
|
+
/**
|
2029
|
+
* Pust the given `node`.
|
2030
|
+
*
|
2031
|
+
* @param {Node} node
|
2032
|
+
* @return {Number}
|
2033
|
+
* @api public
|
2034
|
+
*/
|
2035
|
+
|
2036
|
+
Block.prototype.push = function(node){
|
2037
|
+
return this.nodes.push(node);
|
2038
|
+
};
|
2039
|
+
|
2040
|
+
/**
|
2041
|
+
* Check if this block is empty.
|
2042
|
+
*
|
2043
|
+
* @return {Boolean}
|
2044
|
+
* @api public
|
2045
|
+
*/
|
2046
|
+
|
2047
|
+
Block.prototype.isEmpty = function(){
|
2048
|
+
return 0 == this.nodes.length;
|
2049
|
+
};
|
2050
|
+
|
2051
|
+
/**
|
2052
|
+
* Unshift the given `node`.
|
2053
|
+
*
|
2054
|
+
* @param {Node} node
|
2055
|
+
* @return {Number}
|
2056
|
+
* @api public
|
2057
|
+
*/
|
2058
|
+
|
2059
|
+
Block.prototype.unshift = function(node){
|
2060
|
+
return this.nodes.unshift(node);
|
2061
|
+
};
|
2062
|
+
|
2063
|
+
/**
|
2064
|
+
* Return the "last" block, or the first `yield` node.
|
2065
|
+
*
|
2066
|
+
* @return {Block}
|
2067
|
+
* @api private
|
2068
|
+
*/
|
2069
|
+
|
2070
|
+
Block.prototype.includeBlock = function(){
|
2071
|
+
var ret = this
|
2072
|
+
, node;
|
2073
|
+
|
2074
|
+
for (var i = 0, len = this.nodes.length; i < len; ++i) {
|
2075
|
+
node = this.nodes[i];
|
2076
|
+
if (node.yield) return node;
|
2077
|
+
else if (node.textOnly) continue;
|
2078
|
+
else if (node.includeBlock) ret = node.includeBlock();
|
2079
|
+
else if (node.block && !node.block.isEmpty()) ret = node.block.includeBlock();
|
2080
|
+
}
|
2081
|
+
|
2082
|
+
return ret;
|
2083
|
+
};
|
2084
|
+
|
2085
|
+
/**
|
2086
|
+
* Return a clone of this block.
|
2087
|
+
*
|
2088
|
+
* @return {Block}
|
2089
|
+
* @api private
|
2090
|
+
*/
|
2091
|
+
|
2092
|
+
Block.prototype.clone = function(){
|
2093
|
+
var clone = new Block;
|
2094
|
+
for (var i = 0, len = this.nodes.length; i < len; ++i) {
|
2095
|
+
clone.push(this.nodes[i].clone());
|
2096
|
+
}
|
2097
|
+
return clone;
|
2098
|
+
};
|
2099
|
+
|
2100
|
+
|
2101
|
+
}); // module: nodes/block.js
|
2102
|
+
|
2103
|
+
require.register("nodes/case.js", function(module, exports, require){
|
2104
|
+
|
2105
|
+
/*!
|
2106
|
+
* Jade - nodes - Case
|
2107
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
2108
|
+
* MIT Licensed
|
2109
|
+
*/
|
2110
|
+
|
2111
|
+
/**
|
2112
|
+
* Module dependencies.
|
2113
|
+
*/
|
2114
|
+
|
2115
|
+
var Node = require('./node');
|
2116
|
+
|
2117
|
+
/**
|
2118
|
+
* Initialize a new `Case` with `expr`.
|
2119
|
+
*
|
2120
|
+
* @param {String} expr
|
2121
|
+
* @api public
|
2122
|
+
*/
|
2123
|
+
|
2124
|
+
var Case = exports = module.exports = function Case(expr, block){
|
2125
|
+
this.expr = expr;
|
2126
|
+
this.block = block;
|
2127
|
+
};
|
2128
|
+
|
2129
|
+
/**
|
2130
|
+
* Inherit from `Node`.
|
2131
|
+
*/
|
2132
|
+
|
2133
|
+
Case.prototype = new Node;
|
2134
|
+
Case.prototype.constructor = Case;
|
2135
|
+
|
2136
|
+
|
2137
|
+
var When = exports.When = function When(expr, block){
|
2138
|
+
this.expr = expr;
|
2139
|
+
this.block = block;
|
2140
|
+
this.debug = false;
|
2141
|
+
};
|
2142
|
+
|
2143
|
+
/**
|
2144
|
+
* Inherit from `Node`.
|
2145
|
+
*/
|
2146
|
+
|
2147
|
+
When.prototype = new Node;
|
2148
|
+
When.prototype.constructor = When;
|
2149
|
+
|
2150
|
+
|
2151
|
+
|
2152
|
+
}); // module: nodes/case.js
|
2153
|
+
|
2154
|
+
require.register("nodes/code.js", function(module, exports, require){
|
2155
|
+
|
2156
|
+
/*!
|
2157
|
+
* Jade - nodes - Code
|
2158
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
2159
|
+
* MIT Licensed
|
2160
|
+
*/
|
2161
|
+
|
2162
|
+
/**
|
2163
|
+
* Module dependencies.
|
2164
|
+
*/
|
2165
|
+
|
2166
|
+
var Node = require('./node');
|
2167
|
+
|
2168
|
+
/**
|
2169
|
+
* Initialize a `Code` node with the given code `val`.
|
2170
|
+
* Code may also be optionally buffered and escaped.
|
2171
|
+
*
|
2172
|
+
* @param {String} val
|
2173
|
+
* @param {Boolean} buffer
|
2174
|
+
* @param {Boolean} escape
|
2175
|
+
* @api public
|
2176
|
+
*/
|
2177
|
+
|
2178
|
+
var Code = module.exports = function Code(val, buffer, escape) {
|
2179
|
+
this.val = val;
|
2180
|
+
this.buffer = buffer;
|
2181
|
+
this.escape = escape;
|
2182
|
+
if (val.match(/^ *else/)) this.debug = false;
|
2183
|
+
};
|
2184
|
+
|
2185
|
+
/**
|
2186
|
+
* Inherit from `Node`.
|
2187
|
+
*/
|
2188
|
+
|
2189
|
+
Code.prototype = new Node;
|
2190
|
+
Code.prototype.constructor = Code;
|
2191
|
+
|
2192
|
+
}); // module: nodes/code.js
|
2193
|
+
|
2194
|
+
require.register("nodes/comment.js", function(module, exports, require){
|
2195
|
+
|
2196
|
+
/*!
|
2197
|
+
* Jade - nodes - Comment
|
2198
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
2199
|
+
* MIT Licensed
|
2200
|
+
*/
|
2201
|
+
|
2202
|
+
/**
|
2203
|
+
* Module dependencies.
|
2204
|
+
*/
|
2205
|
+
|
2206
|
+
var Node = require('./node');
|
2207
|
+
|
2208
|
+
/**
|
2209
|
+
* Initialize a `Comment` with the given `val`, optionally `buffer`,
|
2210
|
+
* otherwise the comment may render in the output.
|
2211
|
+
*
|
2212
|
+
* @param {String} val
|
2213
|
+
* @param {Boolean} buffer
|
2214
|
+
* @api public
|
2215
|
+
*/
|
2216
|
+
|
2217
|
+
var Comment = module.exports = function Comment(val, buffer) {
|
2218
|
+
this.val = val;
|
2219
|
+
this.buffer = buffer;
|
2220
|
+
};
|
2221
|
+
|
2222
|
+
/**
|
2223
|
+
* Inherit from `Node`.
|
2224
|
+
*/
|
2225
|
+
|
2226
|
+
Comment.prototype = new Node;
|
2227
|
+
Comment.prototype.constructor = Comment;
|
2228
|
+
|
2229
|
+
}); // module: nodes/comment.js
|
2230
|
+
|
2231
|
+
require.register("nodes/doctype.js", function(module, exports, require){
|
2232
|
+
|
2233
|
+
/*!
|
2234
|
+
* Jade - nodes - Doctype
|
2235
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
2236
|
+
* MIT Licensed
|
2237
|
+
*/
|
2238
|
+
|
2239
|
+
/**
|
2240
|
+
* Module dependencies.
|
2241
|
+
*/
|
2242
|
+
|
2243
|
+
var Node = require('./node');
|
2244
|
+
|
2245
|
+
/**
|
2246
|
+
* Initialize a `Doctype` with the given `val`.
|
2247
|
+
*
|
2248
|
+
* @param {String} val
|
2249
|
+
* @api public
|
2250
|
+
*/
|
2251
|
+
|
2252
|
+
var Doctype = module.exports = function Doctype(val) {
|
2253
|
+
this.val = val;
|
2254
|
+
};
|
2255
|
+
|
2256
|
+
/**
|
2257
|
+
* Inherit from `Node`.
|
2258
|
+
*/
|
2259
|
+
|
2260
|
+
Doctype.prototype = new Node;
|
2261
|
+
Doctype.prototype.constructor = Doctype;
|
2262
|
+
|
2263
|
+
}); // module: nodes/doctype.js
|
2264
|
+
|
2265
|
+
require.register("nodes/each.js", function(module, exports, require){
|
2266
|
+
|
2267
|
+
/*!
|
2268
|
+
* Jade - nodes - Each
|
2269
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
2270
|
+
* MIT Licensed
|
2271
|
+
*/
|
2272
|
+
|
2273
|
+
/**
|
2274
|
+
* Module dependencies.
|
2275
|
+
*/
|
2276
|
+
|
2277
|
+
var Node = require('./node');
|
2278
|
+
|
2279
|
+
/**
|
2280
|
+
* Initialize an `Each` node, representing iteration
|
2281
|
+
*
|
2282
|
+
* @param {String} obj
|
2283
|
+
* @param {String} val
|
2284
|
+
* @param {String} key
|
2285
|
+
* @param {Block} block
|
2286
|
+
* @api public
|
2287
|
+
*/
|
2288
|
+
|
2289
|
+
var Each = module.exports = function Each(obj, val, key, block) {
|
2290
|
+
this.obj = obj;
|
2291
|
+
this.val = val;
|
2292
|
+
this.key = key;
|
2293
|
+
this.block = block;
|
2294
|
+
};
|
2295
|
+
|
2296
|
+
/**
|
2297
|
+
* Inherit from `Node`.
|
2298
|
+
*/
|
2299
|
+
|
2300
|
+
Each.prototype = new Node;
|
2301
|
+
Each.prototype.constructor = Each;
|
2302
|
+
|
2303
|
+
}); // module: nodes/each.js
|
2304
|
+
|
2305
|
+
require.register("nodes/filter.js", function(module, exports, require){
|
2306
|
+
|
2307
|
+
/*!
|
2308
|
+
* Jade - nodes - Filter
|
2309
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
2310
|
+
* MIT Licensed
|
2311
|
+
*/
|
2312
|
+
|
2313
|
+
/**
|
2314
|
+
* Module dependencies.
|
2315
|
+
*/
|
2316
|
+
|
2317
|
+
var Node = require('./node')
|
2318
|
+
, Block = require('./block');
|
2319
|
+
|
2320
|
+
/**
|
2321
|
+
* Initialize a `Filter` node with the given
|
2322
|
+
* filter `name` and `block`.
|
2323
|
+
*
|
2324
|
+
* @param {String} name
|
2325
|
+
* @param {Block|Node} block
|
2326
|
+
* @api public
|
2327
|
+
*/
|
2328
|
+
|
2329
|
+
var Filter = module.exports = function Filter(name, block, attrs) {
|
2330
|
+
this.name = name;
|
2331
|
+
this.block = block;
|
2332
|
+
this.attrs = attrs;
|
2333
|
+
this.isASTFilter = !block.nodes.every(function(node){ return node.isText });
|
2334
|
+
};
|
2335
|
+
|
2336
|
+
/**
|
2337
|
+
* Inherit from `Node`.
|
2338
|
+
*/
|
2339
|
+
|
2340
|
+
Filter.prototype = new Node;
|
2341
|
+
Filter.prototype.constructor = Filter;
|
2342
|
+
|
2343
|
+
}); // module: nodes/filter.js
|
2344
|
+
|
2345
|
+
require.register("nodes/index.js", function(module, exports, require){
|
2346
|
+
|
2347
|
+
/*!
|
2348
|
+
* Jade - nodes
|
2349
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
2350
|
+
* MIT Licensed
|
2351
|
+
*/
|
2352
|
+
|
2353
|
+
exports.Node = require('./node');
|
2354
|
+
exports.Tag = require('./tag');
|
2355
|
+
exports.Code = require('./code');
|
2356
|
+
exports.Each = require('./each');
|
2357
|
+
exports.Case = require('./case');
|
2358
|
+
exports.Text = require('./text');
|
2359
|
+
exports.Block = require('./block');
|
2360
|
+
exports.Mixin = require('./mixin');
|
2361
|
+
exports.Filter = require('./filter');
|
2362
|
+
exports.Comment = require('./comment');
|
2363
|
+
exports.Literal = require('./literal');
|
2364
|
+
exports.BlockComment = require('./block-comment');
|
2365
|
+
exports.Doctype = require('./doctype');
|
2366
|
+
|
2367
|
+
}); // module: nodes/index.js
|
2368
|
+
|
2369
|
+
require.register("nodes/literal.js", function(module, exports, require){
|
2370
|
+
|
2371
|
+
/*!
|
2372
|
+
* Jade - nodes - Literal
|
2373
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
2374
|
+
* MIT Licensed
|
2375
|
+
*/
|
2376
|
+
|
2377
|
+
/**
|
2378
|
+
* Module dependencies.
|
2379
|
+
*/
|
2380
|
+
|
2381
|
+
var Node = require('./node');
|
2382
|
+
|
2383
|
+
/**
|
2384
|
+
* Initialize a `Literal` node with the given `str.
|
2385
|
+
*
|
2386
|
+
* @param {String} str
|
2387
|
+
* @api public
|
2388
|
+
*/
|
2389
|
+
|
2390
|
+
var Literal = module.exports = function Literal(str) {
|
2391
|
+
this.str = str
|
2392
|
+
.replace(/\\/g, "\\\\")
|
2393
|
+
.replace(/\n|\r\n/g, "\\n")
|
2394
|
+
.replace(/'/g, "\\'");
|
2395
|
+
};
|
2396
|
+
|
2397
|
+
/**
|
2398
|
+
* Inherit from `Node`.
|
2399
|
+
*/
|
2400
|
+
|
2401
|
+
Literal.prototype = new Node;
|
2402
|
+
Literal.prototype.constructor = Literal;
|
2403
|
+
|
2404
|
+
|
2405
|
+
}); // module: nodes/literal.js
|
2406
|
+
|
2407
|
+
require.register("nodes/mixin.js", function(module, exports, require){
|
2408
|
+
|
2409
|
+
/*!
|
2410
|
+
* Jade - nodes - Mixin
|
2411
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
2412
|
+
* MIT Licensed
|
2413
|
+
*/
|
2414
|
+
|
2415
|
+
/**
|
2416
|
+
* Module dependencies.
|
2417
|
+
*/
|
2418
|
+
|
2419
|
+
var Attrs = require('./attrs');
|
2420
|
+
|
2421
|
+
/**
|
2422
|
+
* Initialize a new `Mixin` with `name` and `block`.
|
2423
|
+
*
|
2424
|
+
* @param {String} name
|
2425
|
+
* @param {String} args
|
2426
|
+
* @param {Block} block
|
2427
|
+
* @api public
|
2428
|
+
*/
|
2429
|
+
|
2430
|
+
var Mixin = module.exports = function Mixin(name, args, block, call){
|
2431
|
+
this.name = name;
|
2432
|
+
this.args = args;
|
2433
|
+
this.block = block;
|
2434
|
+
this.attrs = [];
|
2435
|
+
this.call = call;
|
2436
|
+
};
|
2437
|
+
|
2438
|
+
/**
|
2439
|
+
* Inherit from `Attrs`.
|
2440
|
+
*/
|
2441
|
+
|
2442
|
+
Mixin.prototype = new Attrs;
|
2443
|
+
Mixin.prototype.constructor = Mixin;
|
2444
|
+
|
2445
|
+
|
2446
|
+
|
2447
|
+
}); // module: nodes/mixin.js
|
2448
|
+
|
2449
|
+
require.register("nodes/node.js", function(module, exports, require){
|
2450
|
+
|
2451
|
+
/*!
|
2452
|
+
* Jade - nodes - Node
|
2453
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
2454
|
+
* MIT Licensed
|
2455
|
+
*/
|
2456
|
+
|
2457
|
+
/**
|
2458
|
+
* Initialize a `Node`.
|
2459
|
+
*
|
2460
|
+
* @api public
|
2461
|
+
*/
|
2462
|
+
|
2463
|
+
var Node = module.exports = function Node(){};
|
2464
|
+
|
2465
|
+
/**
|
2466
|
+
* Clone this node (return itself)
|
2467
|
+
*
|
2468
|
+
* @return {Node}
|
2469
|
+
* @api private
|
2470
|
+
*/
|
2471
|
+
|
2472
|
+
Node.prototype.clone = function(){
|
2473
|
+
return this;
|
2474
|
+
};
|
2475
|
+
|
2476
|
+
}); // module: nodes/node.js
|
2477
|
+
|
2478
|
+
require.register("nodes/tag.js", function(module, exports, require){
|
2479
|
+
|
2480
|
+
/*!
|
2481
|
+
* Jade - nodes - Tag
|
2482
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
2483
|
+
* MIT Licensed
|
2484
|
+
*/
|
2485
|
+
|
2486
|
+
/**
|
2487
|
+
* Module dependencies.
|
2488
|
+
*/
|
2489
|
+
|
2490
|
+
var Attrs = require('./attrs'),
|
2491
|
+
Block = require('./block'),
|
2492
|
+
inlineTags = require('../inline-tags');
|
2493
|
+
|
2494
|
+
/**
|
2495
|
+
* Initialize a `Tag` node with the given tag `name` and optional `block`.
|
2496
|
+
*
|
2497
|
+
* @param {String} name
|
2498
|
+
* @param {Block} block
|
2499
|
+
* @api public
|
2500
|
+
*/
|
2501
|
+
|
2502
|
+
var Tag = module.exports = function Tag(name, block) {
|
2503
|
+
this.name = name;
|
2504
|
+
this.attrs = [];
|
2505
|
+
this.block = block || new Block;
|
2506
|
+
};
|
2507
|
+
|
2508
|
+
/**
|
2509
|
+
* Inherit from `Attrs`.
|
2510
|
+
*/
|
2511
|
+
|
2512
|
+
Tag.prototype = new Attrs;
|
2513
|
+
Tag.prototype.constructor = Tag;
|
2514
|
+
|
2515
|
+
|
2516
|
+
/**
|
2517
|
+
* Clone this tag.
|
2518
|
+
*
|
2519
|
+
* @return {Tag}
|
2520
|
+
* @api private
|
2521
|
+
*/
|
2522
|
+
|
2523
|
+
Tag.prototype.clone = function(){
|
2524
|
+
var clone = new Tag(this.name, this.block.clone());
|
2525
|
+
clone.line = this.line;
|
2526
|
+
clone.attrs = this.attrs;
|
2527
|
+
clone.textOnly = this.textOnly;
|
2528
|
+
return clone;
|
2529
|
+
};
|
2530
|
+
|
2531
|
+
/**
|
2532
|
+
* Check if this tag is an inline tag.
|
2533
|
+
*
|
2534
|
+
* @return {Boolean}
|
2535
|
+
* @api private
|
2536
|
+
*/
|
2537
|
+
|
2538
|
+
Tag.prototype.isInline = function(){
|
2539
|
+
return ~inlineTags.indexOf(this.name);
|
2540
|
+
};
|
2541
|
+
|
2542
|
+
/**
|
2543
|
+
* Check if this tag's contents can be inlined. Used for pretty printing.
|
2544
|
+
*
|
2545
|
+
* @return {Boolean}
|
2546
|
+
* @api private
|
2547
|
+
*/
|
2548
|
+
|
2549
|
+
Tag.prototype.canInline = function(){
|
2550
|
+
var nodes = this.block.nodes;
|
2551
|
+
|
2552
|
+
function isInline(node){
|
2553
|
+
// Recurse if the node is a block
|
2554
|
+
if (node.isBlock) return node.nodes.every(isInline);
|
2555
|
+
return node.isText || (node.isInline && node.isInline());
|
2556
|
+
}
|
2557
|
+
|
2558
|
+
// Empty tag
|
2559
|
+
if (!nodes.length) return true;
|
2560
|
+
|
2561
|
+
// Text-only or inline-only tag
|
2562
|
+
if (1 == nodes.length) return isInline(nodes[0]);
|
2563
|
+
|
2564
|
+
// Multi-line inline-only tag
|
2565
|
+
if (this.block.nodes.every(isInline)) {
|
2566
|
+
for (var i = 1, len = nodes.length; i < len; ++i) {
|
2567
|
+
if (nodes[i-1].isText && nodes[i].isText)
|
2568
|
+
return false;
|
2569
|
+
}
|
2570
|
+
return true;
|
2571
|
+
}
|
2572
|
+
|
2573
|
+
// Mixed tag
|
2574
|
+
return false;
|
2575
|
+
};
|
2576
|
+
}); // module: nodes/tag.js
|
2577
|
+
|
2578
|
+
require.register("nodes/text.js", function(module, exports, require){
|
2579
|
+
|
2580
|
+
/*!
|
2581
|
+
* Jade - nodes - Text
|
2582
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
2583
|
+
* MIT Licensed
|
2584
|
+
*/
|
2585
|
+
|
2586
|
+
/**
|
2587
|
+
* Module dependencies.
|
2588
|
+
*/
|
2589
|
+
|
2590
|
+
var Node = require('./node');
|
2591
|
+
|
2592
|
+
/**
|
2593
|
+
* Initialize a `Text` node with optional `line`.
|
2594
|
+
*
|
2595
|
+
* @param {String} line
|
2596
|
+
* @api public
|
2597
|
+
*/
|
2598
|
+
|
2599
|
+
var Text = module.exports = function Text(line) {
|
2600
|
+
this.val = '';
|
2601
|
+
if ('string' == typeof line) this.val = line;
|
2602
|
+
};
|
2603
|
+
|
2604
|
+
/**
|
2605
|
+
* Inherit from `Node`.
|
2606
|
+
*/
|
2607
|
+
|
2608
|
+
Text.prototype = new Node;
|
2609
|
+
Text.prototype.constructor = Text;
|
2610
|
+
|
2611
|
+
|
2612
|
+
/**
|
2613
|
+
* Flag as text.
|
2614
|
+
*/
|
2615
|
+
|
2616
|
+
Text.prototype.isText = true;
|
2617
|
+
}); // module: nodes/text.js
|
2618
|
+
|
2619
|
+
require.register("parser.js", function(module, exports, require){
|
2620
|
+
|
2621
|
+
/*!
|
2622
|
+
* Jade - Parser
|
2623
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
2624
|
+
* MIT Licensed
|
2625
|
+
*/
|
2626
|
+
|
2627
|
+
/**
|
2628
|
+
* Module dependencies.
|
2629
|
+
*/
|
2630
|
+
|
2631
|
+
var Lexer = require('./lexer')
|
2632
|
+
, nodes = require('./nodes');
|
2633
|
+
|
2634
|
+
/**
|
2635
|
+
* Initialize `Parser` with the given input `str` and `filename`.
|
2636
|
+
*
|
2637
|
+
* @param {String} str
|
2638
|
+
* @param {String} filename
|
2639
|
+
* @param {Object} options
|
2640
|
+
* @api public
|
2641
|
+
*/
|
2642
|
+
|
2643
|
+
var Parser = exports = module.exports = function Parser(str, filename, options){
|
2644
|
+
this.input = str;
|
2645
|
+
this.lexer = new Lexer(str, options);
|
2646
|
+
this.filename = filename;
|
2647
|
+
this.blocks = {};
|
2648
|
+
this.mixins = {};
|
2649
|
+
this.options = options;
|
2650
|
+
this.contexts = [this];
|
2651
|
+
};
|
2652
|
+
|
2653
|
+
/**
|
2654
|
+
* Tags that may not contain tags.
|
2655
|
+
*/
|
2656
|
+
|
2657
|
+
var textOnly = exports.textOnly = ['script', 'style'];
|
2658
|
+
|
2659
|
+
/**
|
2660
|
+
* Parser prototype.
|
2661
|
+
*/
|
2662
|
+
|
2663
|
+
Parser.prototype = {
|
2664
|
+
|
2665
|
+
/**
|
2666
|
+
* Push `parser` onto the context stack,
|
2667
|
+
* or pop and return a `Parser`.
|
2668
|
+
*/
|
2669
|
+
|
2670
|
+
context: function(parser){
|
2671
|
+
if (parser) {
|
2672
|
+
this.contexts.push(parser);
|
2673
|
+
} else {
|
2674
|
+
return this.contexts.pop();
|
2675
|
+
}
|
2676
|
+
},
|
2677
|
+
|
2678
|
+
/**
|
2679
|
+
* Return the next token object.
|
2680
|
+
*
|
2681
|
+
* @return {Object}
|
2682
|
+
* @api private
|
2683
|
+
*/
|
2684
|
+
|
2685
|
+
advance: function(){
|
2686
|
+
return this.lexer.advance();
|
2687
|
+
},
|
2688
|
+
|
2689
|
+
/**
|
2690
|
+
* Skip `n` tokens.
|
2691
|
+
*
|
2692
|
+
* @param {Number} n
|
2693
|
+
* @api private
|
2694
|
+
*/
|
2695
|
+
|
2696
|
+
skip: function(n){
|
2697
|
+
while (n--) this.advance();
|
2698
|
+
},
|
2699
|
+
|
2700
|
+
/**
|
2701
|
+
* Single token lookahead.
|
2702
|
+
*
|
2703
|
+
* @return {Object}
|
2704
|
+
* @api private
|
2705
|
+
*/
|
2706
|
+
|
2707
|
+
peek: function() {
|
2708
|
+
return this.lookahead(1);
|
2709
|
+
},
|
2710
|
+
|
2711
|
+
/**
|
2712
|
+
* Return lexer lineno.
|
2713
|
+
*
|
2714
|
+
* @return {Number}
|
2715
|
+
* @api private
|
2716
|
+
*/
|
2717
|
+
|
2718
|
+
line: function() {
|
2719
|
+
return this.lexer.lineno;
|
2720
|
+
},
|
2721
|
+
|
2722
|
+
/**
|
2723
|
+
* `n` token lookahead.
|
2724
|
+
*
|
2725
|
+
* @param {Number} n
|
2726
|
+
* @return {Object}
|
2727
|
+
* @api private
|
2728
|
+
*/
|
2729
|
+
|
2730
|
+
lookahead: function(n){
|
2731
|
+
return this.lexer.lookahead(n);
|
2732
|
+
},
|
2733
|
+
|
2734
|
+
/**
|
2735
|
+
* Parse input returning a string of js for evaluation.
|
2736
|
+
*
|
2737
|
+
* @return {String}
|
2738
|
+
* @api public
|
2739
|
+
*/
|
2740
|
+
|
2741
|
+
parse: function(){
|
2742
|
+
var block = new nodes.Block, parser;
|
2743
|
+
block.line = this.line();
|
2744
|
+
|
2745
|
+
while ('eos' != this.peek().type) {
|
2746
|
+
if ('newline' == this.peek().type) {
|
2747
|
+
this.advance();
|
2748
|
+
} else {
|
2749
|
+
block.push(this.parseExpr());
|
2750
|
+
}
|
2751
|
+
}
|
2752
|
+
|
2753
|
+
if (parser = this.extending) {
|
2754
|
+
this.context(parser);
|
2755
|
+
var ast = parser.parse();
|
2756
|
+
this.context();
|
2757
|
+
// hoist mixins
|
2758
|
+
for (var name in this.mixins)
|
2759
|
+
ast.unshift(this.mixins[name]);
|
2760
|
+
return ast;
|
2761
|
+
}
|
2762
|
+
|
2763
|
+
return block;
|
2764
|
+
},
|
2765
|
+
|
2766
|
+
/**
|
2767
|
+
* Expect the given type, or throw an exception.
|
2768
|
+
*
|
2769
|
+
* @param {String} type
|
2770
|
+
* @api private
|
2771
|
+
*/
|
2772
|
+
|
2773
|
+
expect: function(type){
|
2774
|
+
if (this.peek().type === type) {
|
2775
|
+
return this.advance();
|
2776
|
+
} else {
|
2777
|
+
throw new Error('expected "' + type + '", but got "' + this.peek().type + '"');
|
2778
|
+
}
|
2779
|
+
},
|
2780
|
+
|
2781
|
+
/**
|
2782
|
+
* Accept the given `type`.
|
2783
|
+
*
|
2784
|
+
* @param {String} type
|
2785
|
+
* @api private
|
2786
|
+
*/
|
2787
|
+
|
2788
|
+
accept: function(type){
|
2789
|
+
if (this.peek().type === type) {
|
2790
|
+
return this.advance();
|
2791
|
+
}
|
2792
|
+
},
|
2793
|
+
|
2794
|
+
/**
|
2795
|
+
* tag
|
2796
|
+
* | doctype
|
2797
|
+
* | mixin
|
2798
|
+
* | include
|
2799
|
+
* | filter
|
2800
|
+
* | comment
|
2801
|
+
* | text
|
2802
|
+
* | each
|
2803
|
+
* | code
|
2804
|
+
* | yield
|
2805
|
+
* | id
|
2806
|
+
* | class
|
2807
|
+
* | interpolation
|
2808
|
+
*/
|
2809
|
+
|
2810
|
+
parseExpr: function(){
|
2811
|
+
switch (this.peek().type) {
|
2812
|
+
case 'tag':
|
2813
|
+
return this.parseTag();
|
2814
|
+
case 'mixin':
|
2815
|
+
return this.parseMixin();
|
2816
|
+
case 'block':
|
2817
|
+
return this.parseBlock();
|
2818
|
+
case 'case':
|
2819
|
+
return this.parseCase();
|
2820
|
+
case 'when':
|
2821
|
+
return this.parseWhen();
|
2822
|
+
case 'default':
|
2823
|
+
return this.parseDefault();
|
2824
|
+
case 'extends':
|
2825
|
+
return this.parseExtends();
|
2826
|
+
case 'include':
|
2827
|
+
return this.parseInclude();
|
2828
|
+
case 'doctype':
|
2829
|
+
return this.parseDoctype();
|
2830
|
+
case 'filter':
|
2831
|
+
return this.parseFilter();
|
2832
|
+
case 'comment':
|
2833
|
+
return this.parseComment();
|
2834
|
+
case 'text':
|
2835
|
+
return this.parseText();
|
2836
|
+
case 'each':
|
2837
|
+
return this.parseEach();
|
2838
|
+
case 'code':
|
2839
|
+
return this.parseCode();
|
2840
|
+
case 'call':
|
2841
|
+
return this.parseCall();
|
2842
|
+
case 'interpolation':
|
2843
|
+
return this.parseInterpolation();
|
2844
|
+
case 'yield':
|
2845
|
+
this.advance();
|
2846
|
+
var block = new nodes.Block;
|
2847
|
+
block.yield = true;
|
2848
|
+
return block;
|
2849
|
+
case 'id':
|
2850
|
+
case 'class':
|
2851
|
+
var tok = this.advance();
|
2852
|
+
this.lexer.defer(this.lexer.tok('tag', 'div'));
|
2853
|
+
this.lexer.defer(tok);
|
2854
|
+
return this.parseExpr();
|
2855
|
+
default:
|
2856
|
+
throw new Error('unexpected token "' + this.peek().type + '"');
|
2857
|
+
}
|
2858
|
+
},
|
2859
|
+
|
2860
|
+
/**
|
2861
|
+
* Text
|
2862
|
+
*/
|
2863
|
+
|
2864
|
+
parseText: function(){
|
2865
|
+
var tok = this.expect('text')
|
2866
|
+
, node = new nodes.Text(tok.val);
|
2867
|
+
node.line = this.line();
|
2868
|
+
return node;
|
2869
|
+
},
|
2870
|
+
|
2871
|
+
/**
|
2872
|
+
* ':' expr
|
2873
|
+
* | block
|
2874
|
+
*/
|
2875
|
+
|
2876
|
+
parseBlockExpansion: function(){
|
2877
|
+
if (':' == this.peek().type) {
|
2878
|
+
this.advance();
|
2879
|
+
return new nodes.Block(this.parseExpr());
|
2880
|
+
} else {
|
2881
|
+
return this.block();
|
2882
|
+
}
|
2883
|
+
},
|
2884
|
+
|
2885
|
+
/**
|
2886
|
+
* case
|
2887
|
+
*/
|
2888
|
+
|
2889
|
+
parseCase: function(){
|
2890
|
+
var val = this.expect('case').val
|
2891
|
+
, node = new nodes.Case(val);
|
2892
|
+
node.line = this.line();
|
2893
|
+
node.block = this.block();
|
2894
|
+
return node;
|
2895
|
+
},
|
2896
|
+
|
2897
|
+
/**
|
2898
|
+
* when
|
2899
|
+
*/
|
2900
|
+
|
2901
|
+
parseWhen: function(){
|
2902
|
+
var val = this.expect('when').val
|
2903
|
+
return new nodes.Case.When(val, this.parseBlockExpansion());
|
2904
|
+
},
|
2905
|
+
|
2906
|
+
/**
|
2907
|
+
* default
|
2908
|
+
*/
|
2909
|
+
|
2910
|
+
parseDefault: function(){
|
2911
|
+
this.expect('default');
|
2912
|
+
return new nodes.Case.When('default', this.parseBlockExpansion());
|
2913
|
+
},
|
2914
|
+
|
2915
|
+
/**
|
2916
|
+
* code
|
2917
|
+
*/
|
2918
|
+
|
2919
|
+
parseCode: function(){
|
2920
|
+
var tok = this.expect('code')
|
2921
|
+
, node = new nodes.Code(tok.val, tok.buffer, tok.escape)
|
2922
|
+
, block
|
2923
|
+
, i = 1;
|
2924
|
+
node.line = this.line();
|
2925
|
+
while (this.lookahead(i) && 'newline' == this.lookahead(i).type) ++i;
|
2926
|
+
block = 'indent' == this.lookahead(i).type;
|
2927
|
+
if (block) {
|
2928
|
+
this.skip(i-1);
|
2929
|
+
node.block = this.block();
|
2930
|
+
}
|
2931
|
+
return node;
|
2932
|
+
},
|
2933
|
+
|
2934
|
+
/**
|
2935
|
+
* comment
|
2936
|
+
*/
|
2937
|
+
|
2938
|
+
parseComment: function(){
|
2939
|
+
var tok = this.expect('comment')
|
2940
|
+
, node;
|
2941
|
+
|
2942
|
+
if ('indent' == this.peek().type) {
|
2943
|
+
node = new nodes.BlockComment(tok.val, this.block(), tok.buffer);
|
2944
|
+
} else {
|
2945
|
+
node = new nodes.Comment(tok.val, tok.buffer);
|
2946
|
+
}
|
2947
|
+
|
2948
|
+
node.line = this.line();
|
2949
|
+
return node;
|
2950
|
+
},
|
2951
|
+
|
2952
|
+
/**
|
2953
|
+
* doctype
|
2954
|
+
*/
|
2955
|
+
|
2956
|
+
parseDoctype: function(){
|
2957
|
+
var tok = this.expect('doctype')
|
2958
|
+
, node = new nodes.Doctype(tok.val);
|
2959
|
+
node.line = this.line();
|
2960
|
+
return node;
|
2961
|
+
},
|
2962
|
+
|
2963
|
+
/**
|
2964
|
+
* filter attrs? text-block
|
2965
|
+
*/
|
2966
|
+
|
2967
|
+
parseFilter: function(){
|
2968
|
+
var block
|
2969
|
+
, tok = this.expect('filter')
|
2970
|
+
, attrs = this.accept('attrs');
|
2971
|
+
|
2972
|
+
this.lexer.pipeless = true;
|
2973
|
+
block = this.parseTextBlock();
|
2974
|
+
this.lexer.pipeless = false;
|
2975
|
+
|
2976
|
+
var node = new nodes.Filter(tok.val, block, attrs && attrs.attrs);
|
2977
|
+
node.line = this.line();
|
2978
|
+
return node;
|
2979
|
+
},
|
2980
|
+
|
2981
|
+
/**
|
2982
|
+
* tag ':' attrs? block
|
2983
|
+
*/
|
2984
|
+
|
2985
|
+
parseASTFilter: function(){
|
2986
|
+
var block
|
2987
|
+
, tok = this.expect('tag')
|
2988
|
+
, attrs = this.accept('attrs');
|
2989
|
+
|
2990
|
+
this.expect(':');
|
2991
|
+
block = this.block();
|
2992
|
+
|
2993
|
+
var node = new nodes.Filter(tok.val, block, attrs && attrs.attrs);
|
2994
|
+
node.line = this.line();
|
2995
|
+
return node;
|
2996
|
+
},
|
2997
|
+
|
2998
|
+
/**
|
2999
|
+
* each block
|
3000
|
+
*/
|
3001
|
+
|
3002
|
+
parseEach: function(){
|
3003
|
+
var tok = this.expect('each')
|
3004
|
+
, node = new nodes.Each(tok.code, tok.val, tok.key);
|
3005
|
+
node.line = this.line();
|
3006
|
+
node.block = this.block();
|
3007
|
+
return node;
|
3008
|
+
},
|
3009
|
+
|
3010
|
+
/**
|
3011
|
+
* 'extends' name
|
3012
|
+
*/
|
3013
|
+
|
3014
|
+
parseExtends: function(){
|
3015
|
+
var path = require('path')
|
3016
|
+
, fs = require('fs')
|
3017
|
+
, dirname = path.dirname
|
3018
|
+
, basename = path.basename
|
3019
|
+
, join = path.join;
|
3020
|
+
|
3021
|
+
if (!this.filename)
|
3022
|
+
throw new Error('the "filename" option is required to extend templates');
|
3023
|
+
|
3024
|
+
var path = this.expect('extends').val.trim()
|
3025
|
+
, dir = dirname(this.filename);
|
3026
|
+
|
3027
|
+
var path = join(dir, path + '.jade')
|
3028
|
+
, str = fs.readFileSync(path, 'utf8')
|
3029
|
+
, parser = new Parser(str, path, this.options);
|
3030
|
+
|
3031
|
+
parser.blocks = this.blocks;
|
3032
|
+
parser.contexts = this.contexts;
|
3033
|
+
this.extending = parser;
|
3034
|
+
|
3035
|
+
// TODO: null node
|
3036
|
+
return new nodes.Literal('');
|
3037
|
+
},
|
3038
|
+
|
3039
|
+
/**
|
3040
|
+
* 'block' name block
|
3041
|
+
*/
|
3042
|
+
|
3043
|
+
parseBlock: function(){
|
3044
|
+
var block = this.expect('block')
|
3045
|
+
, mode = block.mode
|
3046
|
+
, name = block.val.trim();
|
3047
|
+
|
3048
|
+
block = 'indent' == this.peek().type
|
3049
|
+
? this.block()
|
3050
|
+
: new nodes.Block(new nodes.Literal(''));
|
3051
|
+
|
3052
|
+
var prev = this.blocks[name];
|
3053
|
+
|
3054
|
+
if (prev) {
|
3055
|
+
switch (prev.mode) {
|
3056
|
+
case 'append':
|
3057
|
+
block.nodes = block.nodes.concat(prev.nodes);
|
3058
|
+
prev = block;
|
3059
|
+
break;
|
3060
|
+
case 'prepend':
|
3061
|
+
block.nodes = prev.nodes.concat(block.nodes);
|
3062
|
+
prev = block;
|
3063
|
+
break;
|
3064
|
+
}
|
3065
|
+
}
|
3066
|
+
|
3067
|
+
block.mode = mode;
|
3068
|
+
return this.blocks[name] = prev || block;
|
3069
|
+
},
|
3070
|
+
|
3071
|
+
/**
|
3072
|
+
* include block?
|
3073
|
+
*/
|
3074
|
+
|
3075
|
+
parseInclude: function(){
|
3076
|
+
var path = require('path')
|
3077
|
+
, fs = require('fs')
|
3078
|
+
, dirname = path.dirname
|
3079
|
+
, basename = path.basename
|
3080
|
+
, join = path.join;
|
3081
|
+
|
3082
|
+
var path = this.expect('include').val.trim()
|
3083
|
+
, dir = dirname(this.filename);
|
3084
|
+
|
3085
|
+
if (!this.filename)
|
3086
|
+
throw new Error('the "filename" option is required to use includes');
|
3087
|
+
|
3088
|
+
// no extension
|
3089
|
+
if (!~basename(path).indexOf('.')) {
|
3090
|
+
path += '.jade';
|
3091
|
+
}
|
3092
|
+
|
3093
|
+
// non-jade
|
3094
|
+
if ('.jade' != path.substr(-5)) {
|
3095
|
+
var path = join(dir, path)
|
3096
|
+
, str = fs.readFileSync(path, 'utf8');
|
3097
|
+
return new nodes.Literal(str);
|
3098
|
+
}
|
3099
|
+
|
3100
|
+
var path = join(dir, path)
|
3101
|
+
, str = fs.readFileSync(path, 'utf8')
|
3102
|
+
, parser = new Parser(str, path, this.options);
|
3103
|
+
parser.blocks = this.blocks;
|
3104
|
+
parser.mixins = this.mixins;
|
3105
|
+
|
3106
|
+
this.context(parser);
|
3107
|
+
var ast = parser.parse();
|
3108
|
+
this.context();
|
3109
|
+
ast.filename = path;
|
3110
|
+
|
3111
|
+
if ('indent' == this.peek().type) {
|
3112
|
+
ast.includeBlock().push(this.block());
|
3113
|
+
}
|
3114
|
+
|
3115
|
+
return ast;
|
3116
|
+
},
|
3117
|
+
|
3118
|
+
/**
|
3119
|
+
* call ident block
|
3120
|
+
*/
|
3121
|
+
|
3122
|
+
parseCall: function(){
|
3123
|
+
var tok = this.expect('call')
|
3124
|
+
, name = tok.val
|
3125
|
+
, args = tok.args
|
3126
|
+
, mixin = new nodes.Mixin(name, args, new nodes.Block, true);
|
3127
|
+
|
3128
|
+
this.tag(mixin);
|
3129
|
+
if (mixin.block.isEmpty()) mixin.block = null;
|
3130
|
+
return mixin;
|
3131
|
+
},
|
3132
|
+
|
3133
|
+
/**
|
3134
|
+
* mixin block
|
3135
|
+
*/
|
3136
|
+
|
3137
|
+
parseMixin: function(){
|
3138
|
+
var tok = this.expect('mixin')
|
3139
|
+
, name = tok.val
|
3140
|
+
, args = tok.args
|
3141
|
+
, mixin;
|
3142
|
+
|
3143
|
+
// definition
|
3144
|
+
if ('indent' == this.peek().type) {
|
3145
|
+
mixin = new nodes.Mixin(name, args, this.block(), false);
|
3146
|
+
this.mixins[name] = mixin;
|
3147
|
+
return mixin;
|
3148
|
+
// call
|
3149
|
+
} else {
|
3150
|
+
return new nodes.Mixin(name, args, null, true);
|
3151
|
+
}
|
3152
|
+
},
|
3153
|
+
|
3154
|
+
/**
|
3155
|
+
* indent (text | newline)* outdent
|
3156
|
+
*/
|
3157
|
+
|
3158
|
+
parseTextBlock: function(){
|
3159
|
+
var block = new nodes.Block;
|
3160
|
+
block.line = this.line();
|
3161
|
+
var spaces = this.expect('indent').val;
|
3162
|
+
if (null == this._spaces) this._spaces = spaces;
|
3163
|
+
var indent = Array(spaces - this._spaces + 1).join(' ');
|
3164
|
+
while ('outdent' != this.peek().type) {
|
3165
|
+
switch (this.peek().type) {
|
3166
|
+
case 'newline':
|
3167
|
+
this.advance();
|
3168
|
+
break;
|
3169
|
+
case 'indent':
|
3170
|
+
this.parseTextBlock().nodes.forEach(function(node){
|
3171
|
+
block.push(node);
|
3172
|
+
});
|
3173
|
+
break;
|
3174
|
+
default:
|
3175
|
+
var text = new nodes.Text(indent + this.advance().val);
|
3176
|
+
text.line = this.line();
|
3177
|
+
block.push(text);
|
3178
|
+
}
|
3179
|
+
}
|
3180
|
+
|
3181
|
+
if (spaces == this._spaces) this._spaces = null;
|
3182
|
+
this.expect('outdent');
|
3183
|
+
return block;
|
3184
|
+
},
|
3185
|
+
|
3186
|
+
/**
|
3187
|
+
* indent expr* outdent
|
3188
|
+
*/
|
3189
|
+
|
3190
|
+
block: function(){
|
3191
|
+
var block = new nodes.Block;
|
3192
|
+
block.line = this.line();
|
3193
|
+
this.expect('indent');
|
3194
|
+
while ('outdent' != this.peek().type) {
|
3195
|
+
if ('newline' == this.peek().type) {
|
3196
|
+
this.advance();
|
3197
|
+
} else {
|
3198
|
+
block.push(this.parseExpr());
|
3199
|
+
}
|
3200
|
+
}
|
3201
|
+
this.expect('outdent');
|
3202
|
+
return block;
|
3203
|
+
},
|
3204
|
+
|
3205
|
+
/**
|
3206
|
+
* interpolation (attrs | class | id)* (text | code | ':')? newline* block?
|
3207
|
+
*/
|
3208
|
+
|
3209
|
+
parseInterpolation: function(){
|
3210
|
+
var tok = this.advance();
|
3211
|
+
var tag = new nodes.Tag(tok.val);
|
3212
|
+
tag.buffer = true;
|
3213
|
+
return this.tag(tag);
|
3214
|
+
},
|
3215
|
+
|
3216
|
+
/**
|
3217
|
+
* tag (attrs | class | id)* (text | code | ':')? newline* block?
|
3218
|
+
*/
|
3219
|
+
|
3220
|
+
parseTag: function(){
|
3221
|
+
// ast-filter look-ahead
|
3222
|
+
var i = 2;
|
3223
|
+
if ('attrs' == this.lookahead(i).type) ++i;
|
3224
|
+
if (':' == this.lookahead(i).type) {
|
3225
|
+
if ('indent' == this.lookahead(++i).type) {
|
3226
|
+
return this.parseASTFilter();
|
3227
|
+
}
|
3228
|
+
}
|
3229
|
+
|
3230
|
+
var tok = this.advance()
|
3231
|
+
, tag = new nodes.Tag(tok.val);
|
3232
|
+
|
3233
|
+
tag.selfClosing = tok.selfClosing;
|
3234
|
+
|
3235
|
+
return this.tag(tag);
|
3236
|
+
},
|
3237
|
+
|
3238
|
+
/**
|
3239
|
+
* Parse tag.
|
3240
|
+
*/
|
3241
|
+
|
3242
|
+
tag: function(tag){
|
3243
|
+
var dot;
|
3244
|
+
|
3245
|
+
tag.line = this.line();
|
3246
|
+
|
3247
|
+
// (attrs | class | id)*
|
3248
|
+
out:
|
3249
|
+
while (true) {
|
3250
|
+
switch (this.peek().type) {
|
3251
|
+
case 'id':
|
3252
|
+
case 'class':
|
3253
|
+
var tok = this.advance();
|
3254
|
+
tag.setAttribute(tok.type, "'" + tok.val + "'");
|
3255
|
+
continue;
|
3256
|
+
case 'attrs':
|
3257
|
+
var tok = this.advance()
|
3258
|
+
, obj = tok.attrs
|
3259
|
+
, escaped = tok.escaped
|
3260
|
+
, names = Object.keys(obj);
|
3261
|
+
|
3262
|
+
if (tok.selfClosing) tag.selfClosing = true;
|
3263
|
+
|
3264
|
+
for (var i = 0, len = names.length; i < len; ++i) {
|
3265
|
+
var name = names[i]
|
3266
|
+
, val = obj[name];
|
3267
|
+
tag.setAttribute(name, val, escaped[name]);
|
3268
|
+
}
|
3269
|
+
continue;
|
3270
|
+
default:
|
3271
|
+
break out;
|
3272
|
+
}
|
3273
|
+
}
|
3274
|
+
|
3275
|
+
// check immediate '.'
|
3276
|
+
if ('.' == this.peek().val) {
|
3277
|
+
dot = tag.textOnly = true;
|
3278
|
+
this.advance();
|
3279
|
+
}
|
3280
|
+
|
3281
|
+
// (text | code | ':')?
|
3282
|
+
switch (this.peek().type) {
|
3283
|
+
case 'text':
|
3284
|
+
tag.block.push(this.parseText());
|
3285
|
+
break;
|
3286
|
+
case 'code':
|
3287
|
+
tag.code = this.parseCode();
|
3288
|
+
break;
|
3289
|
+
case ':':
|
3290
|
+
this.advance();
|
3291
|
+
tag.block = new nodes.Block;
|
3292
|
+
tag.block.push(this.parseExpr());
|
3293
|
+
break;
|
3294
|
+
}
|
3295
|
+
|
3296
|
+
// newline*
|
3297
|
+
while ('newline' == this.peek().type) this.advance();
|
3298
|
+
|
3299
|
+
tag.textOnly = tag.textOnly || ~textOnly.indexOf(tag.name);
|
3300
|
+
|
3301
|
+
// script special-case
|
3302
|
+
if ('script' == tag.name) {
|
3303
|
+
var type = tag.getAttribute('type');
|
3304
|
+
if (!dot && type && 'text/javascript' != type.replace(/^['"]|['"]$/g, '')) {
|
3305
|
+
tag.textOnly = false;
|
3306
|
+
}
|
3307
|
+
}
|
3308
|
+
|
3309
|
+
// block?
|
3310
|
+
if ('indent' == this.peek().type) {
|
3311
|
+
if (tag.textOnly) {
|
3312
|
+
this.lexer.pipeless = true;
|
3313
|
+
tag.block = this.parseTextBlock();
|
3314
|
+
this.lexer.pipeless = false;
|
3315
|
+
} else {
|
3316
|
+
var block = this.block();
|
3317
|
+
if (tag.block) {
|
3318
|
+
for (var i = 0, len = block.nodes.length; i < len; ++i) {
|
3319
|
+
tag.block.push(block.nodes[i]);
|
3320
|
+
}
|
3321
|
+
} else {
|
3322
|
+
tag.block = block;
|
3323
|
+
}
|
3324
|
+
}
|
3325
|
+
}
|
3326
|
+
|
3327
|
+
return tag;
|
3328
|
+
}
|
3329
|
+
};
|
3330
|
+
|
3331
|
+
}); // module: parser.js
|
3332
|
+
|
3333
|
+
require.register("runtime.js", function(module, exports, require){
|
3334
|
+
|
3335
|
+
/*!
|
3336
|
+
* Jade - runtime
|
3337
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
3338
|
+
* MIT Licensed
|
3339
|
+
*/
|
3340
|
+
|
3341
|
+
/**
|
3342
|
+
* Lame Array.isArray() polyfill for now.
|
3343
|
+
*/
|
3344
|
+
|
3345
|
+
if (!Array.isArray) {
|
3346
|
+
Array.isArray = function(arr){
|
3347
|
+
return '[object Array]' == Object.prototype.toString.call(arr);
|
3348
|
+
};
|
3349
|
+
}
|
3350
|
+
|
3351
|
+
/**
|
3352
|
+
* Lame Object.keys() polyfill for now.
|
3353
|
+
*/
|
3354
|
+
|
3355
|
+
if (!Object.keys) {
|
3356
|
+
Object.keys = function(obj){
|
3357
|
+
var arr = [];
|
3358
|
+
for (var key in obj) {
|
3359
|
+
if (obj.hasOwnProperty(key)) {
|
3360
|
+
arr.push(key);
|
3361
|
+
}
|
3362
|
+
}
|
3363
|
+
return arr;
|
3364
|
+
}
|
3365
|
+
}
|
3366
|
+
|
3367
|
+
/**
|
3368
|
+
* Merge two attribute objects giving precedence
|
3369
|
+
* to values in object `b`. Classes are special-cased
|
3370
|
+
* allowing for arrays and merging/joining appropriately
|
3371
|
+
* resulting in a string.
|
3372
|
+
*
|
3373
|
+
* @param {Object} a
|
3374
|
+
* @param {Object} b
|
3375
|
+
* @return {Object} a
|
3376
|
+
* @api private
|
3377
|
+
*/
|
3378
|
+
|
3379
|
+
exports.merge = function merge(a, b) {
|
3380
|
+
var ac = a['class'];
|
3381
|
+
var bc = b['class'];
|
3382
|
+
|
3383
|
+
if (ac || bc) {
|
3384
|
+
ac = ac || [];
|
3385
|
+
bc = bc || [];
|
3386
|
+
if (!Array.isArray(ac)) ac = [ac];
|
3387
|
+
if (!Array.isArray(bc)) bc = [bc];
|
3388
|
+
ac = ac.filter(nulls);
|
3389
|
+
bc = bc.filter(nulls);
|
3390
|
+
a['class'] = ac.concat(bc).join(' ');
|
3391
|
+
}
|
3392
|
+
|
3393
|
+
for (var key in b) {
|
3394
|
+
if (key != 'class') {
|
3395
|
+
a[key] = b[key];
|
3396
|
+
}
|
3397
|
+
}
|
3398
|
+
|
3399
|
+
return a;
|
3400
|
+
};
|
3401
|
+
|
3402
|
+
/**
|
3403
|
+
* Filter null `val`s.
|
3404
|
+
*
|
3405
|
+
* @param {Mixed} val
|
3406
|
+
* @return {Mixed}
|
3407
|
+
* @api private
|
3408
|
+
*/
|
3409
|
+
|
3410
|
+
function nulls(val) {
|
3411
|
+
return val != null;
|
3412
|
+
}
|
3413
|
+
|
3414
|
+
/**
|
3415
|
+
* Render the given attributes object.
|
3416
|
+
*
|
3417
|
+
* @param {Object} obj
|
3418
|
+
* @param {Object} escaped
|
3419
|
+
* @return {String}
|
3420
|
+
* @api private
|
3421
|
+
*/
|
3422
|
+
|
3423
|
+
exports.attrs = function attrs(obj, escaped){
|
3424
|
+
var buf = []
|
3425
|
+
, terse = obj.terse;
|
3426
|
+
|
3427
|
+
delete obj.terse;
|
3428
|
+
var keys = Object.keys(obj)
|
3429
|
+
, len = keys.length;
|
3430
|
+
|
3431
|
+
if (len) {
|
3432
|
+
buf.push('');
|
3433
|
+
for (var i = 0; i < len; ++i) {
|
3434
|
+
var key = keys[i]
|
3435
|
+
, val = obj[key];
|
3436
|
+
|
3437
|
+
if ('boolean' == typeof val || null == val) {
|
3438
|
+
if (val) {
|
3439
|
+
terse
|
3440
|
+
? buf.push(key)
|
3441
|
+
: buf.push(key + '="' + key + '"');
|
3442
|
+
}
|
3443
|
+
} else if (0 == key.indexOf('data') && 'string' != typeof val) {
|
3444
|
+
buf.push(key + "='" + JSON.stringify(val) + "'");
|
3445
|
+
} else if ('class' == key && Array.isArray(val)) {
|
3446
|
+
buf.push(key + '="' + exports.escape(val.join(' ')) + '"');
|
3447
|
+
} else if (escaped && escaped[key]) {
|
3448
|
+
buf.push(key + '="' + exports.escape(val) + '"');
|
3449
|
+
} else {
|
3450
|
+
buf.push(key + '="' + val + '"');
|
3451
|
+
}
|
3452
|
+
}
|
3453
|
+
}
|
3454
|
+
|
3455
|
+
return buf.join(' ');
|
3456
|
+
};
|
3457
|
+
|
3458
|
+
/**
|
3459
|
+
* Escape the given string of `html`.
|
3460
|
+
*
|
3461
|
+
* @param {String} html
|
3462
|
+
* @return {String}
|
3463
|
+
* @api private
|
3464
|
+
*/
|
3465
|
+
|
3466
|
+
exports.escape = function escape(html){
|
3467
|
+
return String(html)
|
3468
|
+
.replace(/&(?!(\w+|\#\d+);)/g, '&')
|
3469
|
+
.replace(/</g, '<')
|
3470
|
+
.replace(/>/g, '>')
|
3471
|
+
.replace(/"/g, '"');
|
3472
|
+
};
|
3473
|
+
|
3474
|
+
/**
|
3475
|
+
* Re-throw the given `err` in context to the
|
3476
|
+
* the jade in `filename` at the given `lineno`.
|
3477
|
+
*
|
3478
|
+
* @param {Error} err
|
3479
|
+
* @param {String} filename
|
3480
|
+
* @param {String} lineno
|
3481
|
+
* @api private
|
3482
|
+
*/
|
3483
|
+
|
3484
|
+
exports.rethrow = function rethrow(err, filename, lineno){
|
3485
|
+
if (!filename) throw err;
|
3486
|
+
|
3487
|
+
var context = 3
|
3488
|
+
, str = require('fs').readFileSync(filename, 'utf8')
|
3489
|
+
, lines = str.split('\n')
|
3490
|
+
, start = Math.max(lineno - context, 0)
|
3491
|
+
, end = Math.min(lines.length, lineno + context);
|
3492
|
+
|
3493
|
+
// Error context
|
3494
|
+
var context = lines.slice(start, end).map(function(line, i){
|
3495
|
+
var curr = i + start + 1;
|
3496
|
+
return (curr == lineno ? ' > ' : ' ')
|
3497
|
+
+ curr
|
3498
|
+
+ '| '
|
3499
|
+
+ line;
|
3500
|
+
}).join('\n');
|
3501
|
+
|
3502
|
+
// Alter exception message
|
3503
|
+
err.path = filename;
|
3504
|
+
err.message = (filename || 'Jade') + ':' + lineno
|
3505
|
+
+ '\n' + context + '\n\n' + err.message;
|
3506
|
+
throw err;
|
3507
|
+
};
|
3508
|
+
|
3509
|
+
}); // module: runtime.js
|
3510
|
+
|
3511
|
+
require.register("self-closing.js", function(module, exports, require){
|
3512
|
+
|
3513
|
+
/*!
|
3514
|
+
* Jade - self closing tags
|
3515
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
3516
|
+
* MIT Licensed
|
3517
|
+
*/
|
3518
|
+
|
3519
|
+
module.exports = [
|
3520
|
+
'meta'
|
3521
|
+
, 'img'
|
3522
|
+
, 'link'
|
3523
|
+
, 'input'
|
3524
|
+
, 'source'
|
3525
|
+
, 'area'
|
3526
|
+
, 'base'
|
3527
|
+
, 'col'
|
3528
|
+
, 'br'
|
3529
|
+
, 'hr'
|
3530
|
+
];
|
3531
|
+
}); // module: self-closing.js
|
3532
|
+
|
3533
|
+
require.register("utils.js", function(module, exports, require){
|
3534
|
+
|
3535
|
+
/*!
|
3536
|
+
* Jade - utils
|
3537
|
+
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
3538
|
+
* MIT Licensed
|
3539
|
+
*/
|
3540
|
+
|
3541
|
+
/**
|
3542
|
+
* Convert interpolation in the given string to JavaScript.
|
3543
|
+
*
|
3544
|
+
* @param {String} str
|
3545
|
+
* @return {String}
|
3546
|
+
* @api private
|
3547
|
+
*/
|
3548
|
+
|
3549
|
+
var interpolate = exports.interpolate = function(str){
|
3550
|
+
return str.replace(/(\\)?([#!]){(.*?)}/g, function(str, escape, flag, code){
|
3551
|
+
return escape
|
3552
|
+
? str
|
3553
|
+
: "' + "
|
3554
|
+
+ ('!' == flag ? '' : 'escape')
|
3555
|
+
+ "((interp = " + code.replace(/\\'/g, "'")
|
3556
|
+
+ ") == null ? '' : interp) + '";
|
3557
|
+
});
|
3558
|
+
};
|
3559
|
+
|
3560
|
+
/**
|
3561
|
+
* Escape single quotes in `str`.
|
3562
|
+
*
|
3563
|
+
* @param {String} str
|
3564
|
+
* @return {String}
|
3565
|
+
* @api private
|
3566
|
+
*/
|
3567
|
+
|
3568
|
+
var escape = exports.escape = function(str) {
|
3569
|
+
return str.replace(/'/g, "\\'");
|
3570
|
+
};
|
3571
|
+
|
3572
|
+
/**
|
3573
|
+
* Interpolate, and escape the given `str`.
|
3574
|
+
*
|
3575
|
+
* @param {String} str
|
3576
|
+
* @return {String}
|
3577
|
+
* @api private
|
3578
|
+
*/
|
3579
|
+
|
3580
|
+
exports.text = function(str){
|
3581
|
+
return interpolate(escape(str));
|
3582
|
+
};
|
3583
|
+
}); // module: utils.js
|
3584
|
+
|
3585
|
+
window.jade = require("jade");
|
3586
|
+
})();
|