Base of project created

This commit is contained in:
Sebastian Seedorf
2016-01-26 18:24:31 +01:00
parent 89a8e5403e
commit 01f4a0cd49
933 changed files with 171161 additions and 0 deletions

15
node_modules/jade/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,15 @@
test
support
benchmarks
examples
lib-cov
coverage
.gitmodules
.travis.yml
History.md
Makefile
test/
support/
benchmarks/
examples/
docs/

1
node_modules/jade/.release.json generated vendored Normal file
View File

@@ -0,0 +1 @@
"2ab04e8289982bfac3548a9c6016476472dcdb4f"

991
node_modules/jade/History.md generated vendored Normal file
View File

@@ -0,0 +1,991 @@
1.11.0 / 2015-06-12
==================
* Added block code support ([@alephyud](https://github.com/alephyud))
* Improved runtime performance of mixins significantly ([Andreas Lubbe](https://github.com/alubbe))
* Improved runtime performance of jade's string escaping ([Andreas Lubbe](https://github.com/alubbe)) and ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Better line number counting for pipeless text ([@alephyud](https://github.com/alephyud))
1.10.0 / 2015-05-25
==================
* Now supports jstransformers, which allows improved handling of embedded languages such as Coffee-Script, and deprecated Transformers support in filters - to be removed in 2.0.0 ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* CLI: added a flag to keep directory hierarchy when a directory is specified - this behavior will be the default in 2.0.0 ([@TimothyGu](https://github.com/TimothyGu))
* disabled 'compileDebug' flag by default when used with express in production mode ([Andreas Lubbe](https://github.com/alubbe))
* Fixed a memory leak on modern versions of Chrome as well as node 0.12 and iojs ([Andreas Lubbe](https://github.com/alubbe))
* update website ([@GarthDB](https://github.com/GarthDB))
1.9.2 / 2015-01-18
==================
* Do not ignore some parser errors for mismatched parenthesis ([@TimothyGu](https://github.com/TimothyGu))
* Warn for `:` that is not followed by a space ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Fix #1794 (a bizzare bug with a certain combination of inheritance, mixins and &attributes) ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Add `compileClientWithDependenciesTracked` ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Support comments in `case` blocks ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Fix blocks in nested mixins ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Lots more documentation ([@enlore](https://github.com/enlore))
* Fix watching in CLI ([@pavel](https://github.com/pavel))
1.9.1 / 2015-01-17
==================
* Clean up path/fs functions in CLI as we no longer support node@0.6 ([@TimothyGu](https://github.com/TimothyGu))
* Update commander ([@TimothyGu](https://github.com/TimothyGu))
* Document `cache` and `parser` options ([@TimothyGu](https://github.com/TimothyGu))
* Fix bug in 1.9.0 where we read the file if cache was enabled, even if a string was provided ([@TimothyGu](https://github.com/TimothyGu))
* Fix year in changelog ([@tomByrer](https://github.com/tomByrer))
1.9.0 / 2015-01-13
==================
* Fix `--watch` sometimes dying when there were file-system errors ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Fix `--watch` by using `fs.watchFile` correctly ([@TimothyGu](https://github.com/TimothyGu))
* Fix errors with using the CLI to compile from stdin
* Better looking badges ([@TimothyGu](https://github.com/TimothyGu))
* Added `--extension` to CLI([@nicocedron](https://github.com/nicocedron) and [@TimothyGu](https://github.com/TimothyGu))
* Refactor and improve internal cache handling ([@TimothyGu](https://github.com/TimothyGu))
* Loads more tests ([@TimothyGu](https://github.com/TimothyGu))
1.8.2 / 2014-12-16
==================
* Use `-` as the default filename when using stdin on CLI ([@TimothyGu](https://github.com/TimothyGu))
* Prevent some compiler errors being silenced ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Remove use of non-standard `string.trimLeft()` ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Fix bug in CLI when no name was provided for child template ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Remove dependency on monocle (hopefully fixing installation on 0.8) ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Add gitter chat room ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
1.8.1 / 2014-11-30
==================
* Fix corner case when the pretty option was passed a non-string truthy value ([@TimothyGu](https://github.com/TimothyGu))
* Warn when `lexer` is given as an option ([@TimothyGu](https://github.com/TimothyGu))
* Update dependencies ([@TimothyGu](https://github.com/TimothyGu))
1.8.0 / 2014-11-28
==================
* Fix empty text-only block ([@rlidwka](https://github.com/rlidwka))
* Warn about future change to ISO 8601 style dates ([@TimothyGu](https://github.com/TimothyGu) and [@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Add warnings when data-attributes contain ampersands ([@TimothyGu](https://github.com/TimothyGu))
* Allow custom pretty indentation ([@bfred-it](https://github.com/bfred-it))
* Add support for an object in the style attribute ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Add support for an object in the class attribute ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Ignore fs module in browser builds ([@sokra](https://github.com/sokra))
* Update dependencies ([@hildjj](https://github.com/hildjj))
* Check mixin arguments are valid JavaScript expressions ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Remove symlink ([@slang800](https://github.com/slang800))
1.7.0 / 2014-09-17
==================
* Add Doctype option on command line ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Support ES6 style rest args in mixins ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Fix support for unicode newlines (\u2028, \u2029) ([@rlidwka](https://github.com/rlidwka))
* Expose `globals` option from the `with` module ([@sokra](https://github.com/sokra))
* Lots of new documentation ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
1.6.0 / 2014-08-31
==================
* Allow optional white space after `+` when calling a mixin ([@char101](https://github.com/char101))
* Use void-elements module to replace internal self-closing list ([@hemanth](https://github.com/hemanth))
* Fix a warning that eroniously warned for un-used blocks if in an extending template from an include (Reported by [@Dissimulazione](https://github.com/Dissimulazione))
* Fix mixins not working at end of file ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Fix error reporting when mixin block was followed by blank lines ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
1.5.0 / 2014-07-23
==================
* Added compileFile API ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Fix line number in un-used blocks warning ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Fix a warning that eroniously warned for un-used blocks if they were under another block (Reported by [@pesho](https://github.com/pesho))
1.4.2 / 2014-07-16
==================
* Fix a warning that eroniously warned for un-used blocks if they were under a "Code" element (Reported by [@narirou](https://github.com/narirou))
1.4.1 / 2014-07-16
==================
* Fix an error that sometimes resulted in 'unexpected token "pipless-text"' being erroniously thrown (Reported by [@Artazor](https://github.com/Artazor) and [@thenitai](https://github.com/thenitai))
1.4.0 / 2014-07-15
==================
* Fix CLI so it keeps watching when errors occur ([@AndrewTsao](https://github.com/AndrewTsao))
* Support custom names for client side templates ([@ForbesLindesay](http://www.forbeslindesay.co.uk/) and [@dscape](https://github.com/dscape))
* Allow whitepsace other than "space" before attributes passed to mixins (N.B. there is a small chance this could be a breaking change for you) ([@regular](https://github.com/regular))
* Track dependencies so file watchers can be more clever ([@ForbesLindesay](http://www.forbeslindesay.co.uk/) and [@sdether](https://github.com/sdether))
* Allow passing options to filtered includes ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Fix bugs with indentation in filters ([@ForbesLindesay](http://www.forbeslindesay.co.uk/) and [@lackac](https://github.com/lackac))
* Warn on block names that are never used ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
1.3.1 / 2014-04-04
==================
* Fix error with tags in xml that are self-closing in html ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Fix error message for inline tags with content ([@hiddentao](https://github.com/hiddentao))
1.3.0 / 2014-03-02
==================
* Fix a bug where sometimes mixins were removed by an optimisation even though they were being called ([@ForbesLindesay](http://www.forbeslindesay.co.uk/), reported by [@leider](https://github.com/leider))
* Updated with to support automatically detecting when a value is "global" and removed redundant `options.globals` option ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Improve warnings for tags with multiple attributes ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Deprecate (with a warning) `node.clone`, `block.replace`, `attrs.removeAttribute`, `attrs.getAttribute` - these are all internal APIs for the AST ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
1.2.0 / 2014-02-26
==================
* Use variables instead of properties of jade, improving performance and reliability with nested templates ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Support compiling templates from stdin via a user typing ([@yorkie](https://github.com/yorkie))
* Lazily add mixins ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Fix case fall-through ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Earlier errors for `when` without `case` and `else` without `if` ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Allow `if`/`else` etc. to not have a block.
* Remove lib-cov legacy to make browserify work better ([@silver83](https://github.com/silver83))
* Add and improve test coverage using istanbul ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
1.1.5 / 2014-01-19
==================
* Add filename to and fix line numbers for missing space before text warning (@ijin82)
* Fix filenames for some error reporting in extends/includes (@doublerebel)
* Fix a corner case where a mixin was called with `&attributes` but no other attributes and a block that was supposed to be fixed in 1.1.4 ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
1.1.4 / 2014-01-09
==================
* Fix a corner case where a mixin was called with `&attributes` but no other attributes and a block ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
1.1.3 / 2014-01-09
==================
* Fix failure of npm prepublish not running
1.1.2 / 2014-01-09
==================
* Fix same interaction of `&attributes` with `false` `null` or `undefined` but combined with dynamic attributes ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
1.1.1 / 2014-01-09
==================
* Fix a bug when `&attributes` is combined with static attributes that evaluate to `false` or `null` or `undefined` ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
1.1.0 / 2014-01-07
==================
* Fix class merging to work as documented ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Throw an error when the same attribute is duplicated multiple times ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Move more errors into the parser/lexer so they have more info about line numbers ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Support mixin blocks at the end of files ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
1.0.2 / 2013-12-31
==================
* Fix a bug when `&attributes` is combined with dynamic attributes ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
1.0.1 / 2013-12-29
==================
* Allow self closing tags to contian whitespace ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Allow tags to have a single white space after them ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Support text bodies of tags that begin with `//` rather than treating them as comments ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
1.0.0 / 2013-12-22
==================
* No longer support node@0.8 ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Fix error reporting in layouts & includes ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Allow a list of 'globals' to be passed as an array at compile time & don't automatically expose all globals ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Escape apostrophes in data attributes (@qualiabyte)
* Fix mixin/block interaction ([@ForbesLindesay](http://www.forbeslindesay.co.uk/) & [@paulyoung](https://github.com/paulyoung))
* Ignore trailing space after mixin declaration ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Make literal `.` work as expected ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Remove implicit text only for script/style ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Stop parsing comments and remove support for conditional comments ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Make filtering includes explicit ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Remove special assignment syntax ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Remove `!!!` shortcut for `doctype` ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Remove `5` shorcut for `html` doctype ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Remove `colons` option from the distant past ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Add a sepatate `compileClient` and `compileFileClient` to replace the `client` option ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Remove polyfills for supporting old browsers ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Allow interpolation for mixin names ([@jeromew](https://github.com/jeromew)
* Use `node.type` instead of `node.constructor.name` so it can be minified ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Allow hyphens in filter names ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Throw an error if a self closing tag has content ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Support inline tags ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Replace `attributes` magic attribute with `&attributes(attributes)` ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Remove automatic tag wrapping for filters, you can just put the tags in yourself now ([@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Remove whitespace from tags nested inside pre tags ([@markdalgleish](http://markdalgleish.com))
0.35.0 / 2013-08-21
===================
* Add support for space separated attributes (thanks to [@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Add earlier errors for invalid JavaScript expressions (thanks to [@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* Fix parsing files with UTF8 BOMs when they are includes or parent/layout templates (thanks to [@kiinoo](https://github.com/kiinoo))
0.34.1 / 2013-07-26
===================
* fix render file not working when called with callback (reported by [@xieren58](https://github.com/xieren58))
0.34.0 / 2013-07-26
===================
* callbacks only called once for async methods even if they throw (reported by [@davidcornu](https://github.com/davidcornu))
* HTML comments are pretty printed better (thanks to [@eddiemonge](https://github.com/eddiemonge))
* callbacks are optional and leaving them out results in synchronous operation (thanks to [@ForbesLindesay](http://www.forbeslindesay.co.uk/))
* empty filter nodes are now permitted (thanks to [@coderanger](https://github.com/coderanger))
* overhaul website and documentation (thanks to [@ForbesLindesay](http://www.forbeslindesay.co.uk/)), much more of this to come.
0.33.0 / 2013-07-12
===================
* Hugely more powerful error reporting (especially with `compileDebug` set explicitly to `true`)
* Add a warning for tags with multiple attributes
* be strict about requiring newlines after tags to fix some odd corner cases
* fix escaping of class to allow it to be unescaped (thanks to [@christiangenco](https://github.com/christiangenco))
0.32.0 / 2013-06-28
===================
* remove `jade.version` and fix `jade --version`
* add file name and line number to deprecation warnings
* use constantinople for better constant detection
* update `with` for a massive performance upgrade at compile time
0.31.2 / 2013-06-07
===================
* fix overzealous deprecation warnings
0.31.1 / 2013-05-31
===================
* fix line endings for executable command
* fix `locals` variable being undefined
* fix an obscure bug that could occur if multiple mixins interact badly (see [substack/lexical-scope#13](https://github.com/substack/lexical-scope/issues/13))
0.31.0 / 2013-05-30
==================
* deprecate implicit text-only `script` and `style` tags
* make `with` at compile time using `lexical-scope`
* add `options.parser` that behaves exactly like `options.compiler`
* add "component.json" for component (runtime) support
* removed `hasOwnProperty` check in each loops
* removed .min files from the repository (people can just generate these themselves)
* use browserify to compile client side libraries
* fix buggy block extending should now be fixed
* fix preserve case of custom doctypes
* fix regexps in attributes sometimes not being accepted
* fix allow `$` sign in each loop variable names
* fix mixins with buffered code on the same line
* fix separate class names by ` ` rather than `,` (was sometimes incorrect)
0.30.0 / 2013-04-25
==================
* add support for 'include' and 'extends' to use paths relative to basedir
* fix accidental calling of functions in iteration block. Closes #986
* fix: skip rethrow on client
* fix each/else prefixed with `-`
* fix multi-block prepend/append
* swap -o and -O, set -o to --out
0.29.0 / 2013-04-16
==================
* add "monocle" for watcher that actually works...
* fix interpolation in blocks of text
* fix attribute interpolation
* move filters to an external library
* fix JavaScript escaping corner cases
0.28.2 / 2013-03-04
==================
* wtf coffeescript is not a dep
0.28.1 / 2013-01-10
==================
* add passing of filename to include filters
* fix wrong new lines for include filters
0.28.0 / 2013-01-08
==================
* add .css and .js "filters". re #438
* add include filters. Closes #283
* fix "class:" within attribute escaping
* removing ast filters
* things I can't read:
* 反馈地址
* 样式
* 联系
* 初稿,翻译完
* 接受大鸟的建议
* 头晕,翻译一点点
* 到过滤器翻译完毕
* 翻译一部分
* 中文翻译单独放
* 特性部分
* 再翻
* 翻译一点点
0.27.7 / 2012-11-05
==================
* fix each/else clause for enumerated objects
* fix #764 (incorrect line number for error messages)
* fix double-escaping of interpolated js slashes. Closes #784
0.27.6 / 2012-10-05
==================
* Included templates can not override blocks of their parent. Closes #699
0.27.5 / 2012-09-24
==================
* fix attr interpolation escaping. Closes #771
0.27.4 / 2012-09-18
==================
* fix include yields. Closes #770
0.27.3 / 2012-09-18
==================
* fix escaping of interpolation. Closes #769
* loosen "mkdirp" version restriction [TooTallNate]
0.27.2 / 2012-08-07
==================
* Revert "fixing string interpolation escaping #731", problems reported
0.27.1 / 2012-08-06
==================
* fix attribute interpolation escaping #731
* fix string interpolation escaping #731
0.27.0 / 2012-07-26
==================
* added ability to pass in json file to `--obj`
* add preliminary `each` `else` support. Closes #716
* fix doctype bug overlooked in #712
* fix stripping of utf-8 BOMs
0.26.3 / 2012-06-25
==================
* Update version of commander that supports node v0.8.
0.26.2 / 2012-06-22
==================
* Added --options alias of --obj
* Added reserved word conflict prevention in Google's Closure Compiler
* Added tag interpolation. Closes #657
* Allow the compiled client to use it's own jade util functions [3rd-Eden]
* Fixed `attrs()` escape bug [caseywebdev]
0.26.1 / 2012-05-27
==================
* Changed default doctype to __html5__
* Performance: statically compile attrs when possible [chowey]
* Fixed some class attribute merging cases
* Fixed so `block` doesn't consume `blockquotes` tag [chowey]
* Fixed backslashes in text nodes [chowey]
* Fixed / in text. Closes #638
0.26.0 / 2012-05-04
==================
* Added package.json __component__ support
* Added explicit self-closing tag support. Closes #605
* Added `block` statement
* Added mixin tag-like behaviour [chowey]
* Fixed mixins with extends [chowey]
0.25.0 / 2012-04-18
==================
* Added preliminary mixin block support. Closes #310
* Fixed whitespace handling in various situations [chowey]
* Fixed indentation in various situations [chowey]
0.24.0 / 2012-04-12
==================
* Fixed unescaped attribute compilation
* Fixed pretty-printing of text-only tags (__Warning__: this may affect rendering) [chowey]
0.23.0 / 2012-04-11
==================
* Added data-attr json stringification support. Closes #572
* Added unescaped attr support. Closes #198
* Fixed #1070, reverted mixin function statements
* Fixed jade.1 typo
0.22.1 / 2012-04-04
==================
* Fixed source tags. now self-closing. Closes #308
* Fixed: escape backslashes in coffeescript filter
0.22.0 / 2012-03-22
==================
* Added jade manpage (`man jade` after installation for docs)
* Added `-D, --no-debug` to jade(1)
* Added `-p, --pretty` to jade(1)
* Added `-c, --client` option to jade(1)
* Fixed `-o { client: true }` with stdin
* Fixed: skip blank lines in lexer (unless within pipeless text). Closes #399
0.21.0 / 2012-03-10
==================
* Added new input/output test suite using Mocha's string diffing
* Added alias `extend` -> `extends`. Closes #527 [guillermo]
* Fixed include escapes. Closes #513
* Fixed block-expansion with .foo and #foo short-hands. Closes #498
0.20.3 / 2012-02-16
==================
* Changed: pass `.filename` to filters only
0.20.2 / 2012-02-16
==================
* Fixed `:stylus` import capabilities, pass .filename
0.20.1 / 2012-02-02
==================
* Fixed Block#includeBlock() with textOnly blocks
0.20.0 / 2011-12-28
==================
* Added a browser example
* Added `yield` for block `include`s
* Changed: replaced internal `__` var with `__jade` [chrisleishman]
* Fixed two globals. Closes #433
0.19.0 / 2011-12-02
==================
* Added block `append` / `prepend` support. Closes #355
* Added link in readme to jade-mode for Emacs
* Added link to python implementation
0.18.0 / 2011-11-21
==================
* Changed: only ['script', 'style'] are text-only. Closes #398'
0.17.0 / 2011-11-10
==================
* jade.renderFile() is back! (for express 3.x)
* Fixed `Object.keys()` failover bug
0.16.4 / 2011-10-24
==================
* Fixed a test due to reserved keyword
* Fixed: commander 0.1.x dep for 0.5.x
0.16.3 / 2011-10-24
==================
* Added: allow leading space for conditional comments
* Added quick implementation of a switch statement
* Fixed parens in mixin args. Closes #380
* Fixed: include files with a .jade extension as jade files
0.16.2 / 2011-09-30
==================
* Fixed include regression. Closes #354
0.16.1 / 2011-09-29
==================
* Fixed unexpected `else` bug when compileDebug: false
* Fixed attr state issue for balancing pairs. Closes #353
0.16.0 / 2011-09-26
==================
* Added `include` block support. Closes #303
* Added template inheritance via `block` and `extends`. Closes #242
* Added 'type="text/css"' to the style tags generated by filters.
* Added 'uglifyjs' as an explicit devDependency.
* Added -p, --path <path> flag to jade(1)
* Added support for any arbitrary doctype
* Added `jade.render(str[,options], fn)` back
* Added first-class `while` support
* Added first-class assignment support
* Fixed runtime.js `Array.isArray()` polyfill. Closes #345
* Fixed: set .filename option in jade(1) when passing filenames
* Fixed `Object.keys()` polyfill typo. Closes #331
* Fixed `include` error context
* Renamed magic "index" to "$index". Closes #350
0.15.4 / 2011-09-05
==================
* Fixed script template html. Closes #316
* Revert "Fixed script() tag with trailing ".". Closes #314"
0.15.3 / 2011-08-30
==================
* Added Makefile example. Closes #312
* Fixed script() tag with trailing ".". Closes #314
0.15.2 / 2011-08-26
==================
* Fixed new conditional boundaries. Closes #307
0.15.1 / 2011-08-26
==================
* Fixed jade(1) support due to `res.render()` removal
* Removed --watch support (use a makefile + watch...)
0.15.0 / 2011-08-26
==================
* Added `client` option to reference runtime helpers
* Added `Array.isArray()` for runtime.js as well
* Added `Object.keys()` for the client-side runtime
* Added first-class `if`, `unless`, `else` and `else if` support
* Added first-class `each` / `for` support
* Added `make benchmark` for continuous-bench
* Removed `inline` option, SS helpers are no longer inlined either
* Removed `Parser#debug()`
* Removed `jade.render()` and `jade.renderFile()`
* Fixed runtime.js `escape()` bug causing window.escape to be used
* Fixed a bunch of tests
0.14.2 / 2011-08-16
==================
* Added `include` support for non-jade files
* Fixed code indentation when followed by newline(s). Closes #295 [reported by masylum]
0.14.1 / 2011-08-14
==================
* Added `colons` option for everyone stuck with ":". Closes #231
* Optimization: consecutive lines are merged in compiled js
0.14.0 / 2011-08-08
==================
* Added array iteration with index example. Closes #276
* Added _runtime.js_
* Added `compileDebug` option to enable lineno instrumentation
* Added `inline` option to disable inlining of helpers (for client-side)
0.13.0 / 2011-07-13
==================
* Added `mixin` support
* Added `include` support
* Added array support for the class attribute
0.12.4 / 2011-06-23
==================
* Fixed filter indentation bug. Closes #243
0.12.3 / 2011-06-21
==================
* Fixed empty strings support. Closes #223
* Fixed conditional comments documentation. Closes #245
0.12.2 / 2011-06-16
==================
* Fixed `make test`
* Fixed block comments
0.12.1 / 2011-06-04
==================
* Fixed attribute interpolation with double quotes. Fixes #232 [topaxi]
0.12.0 / 2011-06-03
==================
* Added `doctype` as alias of `!!!`
* Added; doctype value is now case-insensitive
* Added attribute interpolation support
* Fixed; retain original indentation spaces in text blocks
0.11.1 / 2011-06-01
==================
* Fixed text block indentation [Laszlo Bacsi]
* Changed; utilizing devDependencies
* Fixed try/catch issue with renderFile(). Closes #227
* Removed attribute ":" support, use "=" (option for ':' coming soon)
0.11.0 / 2011-05-14
==================
* Added `self` object to avoid poor `with(){}` performance [masylum]
* Added `doctype` option [Jeremy Larkin]
0.10.7 / 2011-05-04
==================
* expose Parser
0.10.6 / 2011-04-29
==================
* Fixed CS `Object.keys()` [reported by robholland]
0.10.5 / 2011-04-26
==================
* Added error context after the lineno
* Added; indicate failing lineno with ">"
* Added `Object.keys()` for the client-side
* Fixed attr strings when containing the opposite quote. Closes 207
* Fixed attr issue with js expressions within strings
* Fixed single-quote filter escape bug. Closes #196
0.10.4 / 2011-04-05
==================
* Added `html` doctype, same as "5"
* Fixed `pre`, no longer text-only
0.10.3 / 2011-03-30
==================
* Fixed support for quoted attribute keys ex `rss("xmlns:atom"="atom")`
0.10.2 / 2011-03-30
==================
* Fixed pipeless text bug with missing outdent
0.10.1 / 2011-03-28
==================
* Fixed `support/compile.js` to exclude browser js in node
* Fixes for IE [Patrick Pfeiffer]
0.10.0 / 2011-03-25
==================
* Added AST-filter support back in the form of `<tag>[attrs]<:><block>`
0.9.3 / 2011-03-24
==================
* Added `Block#unshift(node)`
* Added `jade.js` for the client-side to the repo
* Added `jade.min.js` for the client-side to the repo
* Removed need for pipes in filters. Closes #185
Note that this _will_ break filters used to
manipulate the AST, until we have a different
syntax for doing so.
0.9.2 / 2011-03-23
==================
* Added jade `--version`
* Removed `${}` interpolation support, use `#{}`
0.9.1 / 2011-03-16
==================
* Fixed invalid `.map()` call due to recent changes
0.9.0 / 2011-03-16
==================
* Added client-side browser support via `make jade.js` and `make jade.min.js`.
0.8.9 / 2011-03-15
==================
* Fixed preservation of newlines in text blocks
0.8.8 / 2011-03-14
==================
* Fixed jade(1) stdio
0.8.7 / 2011-03-14
==================
* Added `mkdirs()` to jade(1)
* Added jade(1) stdio support
* Added new features to jade(1), `--watch`, recursive compilation etc [khingebjerg]
* Fixed pipe-less text newlines
* Removed jade(1) `--pipe` flag
0.8.6 / 2011-03-11
==================
* Fixed parenthesized expressions in attrs. Closes #170
* Changed; default interpolation values `== null` to ''. Closes #167
0.8.5 / 2011-03-09
==================
* Added pipe-less text support with immediate ".". Closes #157
* Fixed object support in attrs
* Fixed array support for attrs
0.8.4 / 2011-03-08
==================
* Fixed issue with expressions being evaluated several times. closes #162
0.8.2 / 2011-03-07
==================
* Added markdown, discount, and markdown-js support to `:markdown`. Closes #160
* Removed `:discount`
0.8.1 / 2011-03-04
==================
* Added `pre` pipe-less text support (and auto-escaping)
0.8.0 / 2011-03-04
==================
* Added block-expansion support. Closes #74
* Added support for multi-line attrs without commas. Closes #65
0.7.1 / 2011-03-04
==================
* Fixed `script()` etc pipe-less text with attrs
0.7.0 / 2011-03-04
==================
* Removed `:javascript` filter (it doesn't really do anything special, use `script` tags)
* Added pipe-less text support. Tags that only accept text nodes (`script`, `textarea`, etc) do not require `|`.
* Added `:text` filter for ad-hoc pipe-less
* Added flexible indentation. Tabs, arbitrary number of spaces etc
* Added conditional-comment support. Closes #146
* Added block comment support
* Added rss example
* Added `:stylus` filter
* Added `:discount` filter
* Fixed; auto-detect xml and do not self-close tags. Closes #147
* Fixed whitespace issue. Closes #118
* Fixed attrs. `,`, `=`, and `:` within attr value strings are valid Closes #133
* Fixed; only output "" when code == null. Ex: `span.name= user.name` when undefined or null will not output "undefined". Closes #130
* Fixed; throw on unexpected token instead of hanging
0.6.3 / 2011-02-02
==================
* Added `each` support for Array-like objects [guillermo]
0.6.2 / 2011-02-02
==================
* Added CSRF example, showing how you can transparently add inputs to a form
* Added link to vim-jade
* Fixed self-closing col support [guillermo]
* Fixed exception when getAttribute or removeAttribute run into removed attributes [Naitik Shah]
0.6.0 / 2010-12-19
==================
* Added unescaped interpolation variant `!{code}`. Closes #124
* Changed; escape interpolated code by default `#{code}`
0.5.7 / 2010-12-08
==================
* Fixed; hyphen in get `tag()`
0.5.6 / 2010-11-24
==================
* Added `exports.compile(str, options)`
* Renamed internal `_` to `__`, since `_()` is commonly used for translation
0.5.5 / 2010-10-30
==================
* Add _coffeescript_ filter [Michael Hampton]
* Added link to _slim_; a ruby implementation
* Fixed quoted attributes issue.
* Fixed attribute issue with over greedy regexp.
Previously "p(foo=(((('bar')))))= ((('baz')))"
would __fail__ for example since the regexp
would lookahead to far. Now we simply pair
the delimiters.
0.5.4 / 2010-10-18
==================
* Adding newline when using tag code when preceding text
* Assume newline in tag text when preceding text
* Changed; retain leading text whitespace
* Fixed code block support to prevent multiple buffer openings [Jake Luer]
* Fixed nested filter support
0.5.3 / 2010-10-06
==================
* Fixed bug when tags with code also have a block [reported by chrisirhc]
0.5.2 / 2010-10-05
==================
* Added; Text introduces newlines to mimic the grammar.
Whitespace handling is a little tricky with this sort of grammar.
Jade will now mimic the written grammar, meaning that text blocks
using the "|" margin character will introduce a literal newline,
where as immediate tag text (ex "a(href='#') Link") will not.
This may not be ideal, but it makes more sense than what Jade was
previously doing.
* Added `Tag#text` to disambiguate between immediate / block text
* Removed _pretty_ option (was kinda useless in the state it was in)
* Reverted ignoring of newlines. Closes #92.
* Fixed; `Parser#parse()` ignoring newlines
0.5.1 / 2010-10-04
==================
* Added many examples
* Added; compiler api is now public
* Added; filters can accept / manipulate the parse tree
* Added filter attribute support. Closes #79
* Added LL(*) capabilities
* Performance; wrapping code blocks in {} instead of `(function(){}).call(this)`
* Performance; Optimized attribute buffering
* Fixed trailing newlines in blocks
0.5.0 / 2010-09-11
==================
* __Major__ refactor. Logic now separated into lexer/parser/compiler for future extensibility.
* Added _pretty_ option
* Added parse tree output for _debug_ option
* Added new examples
* Removed _context_ option, use _scope_
0.4.1 / 2010-09-09
==================
* Added support for arbitrary indentation for single-line comments. Closes #71
* Only strip first space in text (ex '| foo' will buffer ' foo')
0.4.0 / 2010-08-30
==================
* Added tab naive support (tabs are converted to a single indent, aka two spaces). Closes #24
* Added unbuffered comment support. Closes #62
* Added hyphen support for tag names, ex: "fb:foo-bar"
* Fixed bug with single quotes in comments. Closes #61
* Fixed comment whitespace issue, previously padding. Closes #55
0.3.0 / 2010-08-04
==================
* Added single line comment support. Closes #25
* Removed CDATA from _:javascript_ filter. Closes #47
* Removed _sys_ local
* Fixed code following tag
0.2.4 / 2010-08-02
==================
* Added Buffer support to `render()`
* Fixed filter text block exception reporting
* Fixed tag exception reporting
0.2.3 / 2010-07-27
==================
* Fixed newlines before block
* Fixed; tag text allowing arbitrary trailing whitespace
0.2.2 / 2010-07-16
==================
* Added support for `jade.renderFile()` to utilize primed cache
* Added link to [textmate bundle](http://github.com/miksago/jade-tmbundle)
* Fixed filter issue with single quotes
* Fixed hyphenated attr bug
* Fixed interpolation single quotes. Closes #28
* Fixed issue with comma in attrs
0.2.1 / 2010-07-09
==================
* Added support for node-discount and markdown-js
depending on which is available.
* Added support for tags to have blocks _and_ text.
this kinda fucks with arbitrary whitespace unfortunately,
but also fixes trailing spaces after tags _with_ blocks.
* Caching generated functions. Closes #46
0.2.0 / 2010-07-08
==================
* Added `- each` support for readable iteration
* Added [markdown-js](http://github.com/evilstreak/markdown-js) support (no compilation required)
* Removed node-discount support
0.1.0 / 2010-07-05
==================
* Added `${}` support for interpolation. Closes #45
* Added support for quoted attr keys: `label("for": 'something')` is allowed (_although not required_) [Guillermo]
* Added `:less` filter [jakeluer]
0.0.2 / 2010-07-03
==================
* Added `context` as synonym for `scope` option [Guillermo]
* Fixed attr splitting: `div(style:"color: red")` is now allowed
* Fixed issue with `(` and `)` within attrs: `a(class: (a ? 'a' : 'b'))` is now allowed
* Fixed issue with leading / trailing spaces in attrs: `a( href="#" )` is now allowed [Guillermo]

22
node_modules/jade/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2009-2014 TJ Holowaychuk <tj@vision-media.ca>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

154
node_modules/jade/README.md generated vendored Normal file
View File

@@ -0,0 +1,154 @@
# [![Jade - Node Template Engine](http://garthdb.com/img/jade_branding/jade-01.svg)](http://jade-lang.com/)
Full documentation is at [jade-lang.com](http://jade-lang.com/)
Jade is a high performance template engine heavily influenced by [Haml](http://haml-lang.com)
and implemented with JavaScript for [node](http://nodejs.org) and browsers. For bug reports,
feature requests and questions, [open an issue](https://github.com/jadejs/jade/issues/new).
For discussion join the [chat room](https://gitter.im/jadejs/jade).
You can test drive Jade online [here](http://naltatis.github.com/jade-syntax-docs).
[![Build Status](https://img.shields.io/travis/jadejs/jade/master.svg?style=flat)](https://travis-ci.org/jadejs/jade)
[![Coverage Status](https://img.shields.io/coveralls/jadejs/jade/master.svg?style=flat)](https://coveralls.io/r/jadejs/jade?branch=master)
[![Dependency Status](https://img.shields.io/david/jadejs/jade.svg?style=flat)](https://david-dm.org/jadejs/jade)
[![devDependencies Status](https://img.shields.io/david/dev/jadejs/jade.svg?style=flat)](https://david-dm.org/jadejs/jade#info=devDependencies)
[![NPM version](https://img.shields.io/npm/v/jade.svg?style=flat)](http://badge.fury.io/js/jade)
[![Join Gitter Chat](https://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg?style=flat)](https://gitter.im/jadejs/jade?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
## Installation
via npm:
```bash
$ npm install jade
```
## Syntax
Jade is a clean, whitespace sensitive syntax for writing html. Here is a simple example:
```jade
doctype html
html(lang="en")
head
title= pageTitle
script(type='text/javascript').
if (foo) bar(1 + 5)
body
h1 Jade - node template engine
#container.col
if youAreUsingJade
p You are amazing
else
p Get on it!
p.
Jade is a terse and simple templating language with a
strong focus on performance and powerful features.
```
becomes
```html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Jade</title>
<script type="text/javascript">
if (foo) bar(1 + 5)
</script>
</head>
<body>
<h1>Jade - node template engine</h1>
<div id="container" class="col">
<p>You are amazing</p>
<p>Jade is a terse and simple templating language with a strong focus on performance and powerful features.</p>
</div>
</body>
</html>
```
The official [jade tutorial](http://jade-lang.com/tutorial/) is a great place to start. While that (and the syntax documentation) is being finished, you can view some of the old documentation [here](https://github.com/jadejs/jade/blob/master/jade.md) and [here](https://github.com/jadejs/jade/blob/master/jade-language.md)
## API
For full API, see [jade-lang.com/api](http://jade-lang.com/api/)
```js
var jade = require('jade');
// compile
var fn = jade.compile('string of jade', options);
var html = fn(locals);
// render
var html = jade.render('string of jade', merge(options, locals));
// renderFile
var html = jade.renderFile('filename.jade', merge(options, locals));
```
### Options
- `filename` Used in exceptions, and required when using includes
- `compileDebug` When `false` no debug instrumentation is compiled
- `pretty` Add pretty-indentation whitespace to output _(false by default)_
## Browser Support
The latest version of jade can be download for the browser in standalone form from [here](https://github.com/jadejs/jade/raw/master/jade.js). It only supports the very latest browsers though, and is a large file. It is recommended that you pre-compile your jade templates to JavaScript and then just use the [runtime.js](https://github.com/jadejs/jade/raw/master/runtime.js) library on the client.
To compile a template for use on the client using the command line, do:
```console
$ jade --client --no-debug filename.jade
```
which will produce `filename.js` containing the compiled template.
## Command Line
After installing the latest version of [node](http://nodejs.org/), install with:
```console
$ npm install jade -g
```
and run with
```console
$ jade --help
```
## Additional Resources
Tutorials:
- cssdeck interactive [Jade syntax tutorial](http://cssdeck.com/labs/learning-the-jade-templating-engine-syntax)
- cssdeck interactive [Jade logic tutorial](http://cssdeck.com/labs/jade-templating-tutorial-codecast-part-2)
- [Jade について。](https://gist.github.com/japboy/5402844) (A Japanese Tutorial)
- [Jade - 模板引擎](https://github.com/jadejs/jade/blob/master/Readme_zh-cn.md)
Implementations in other languages:
- [php](http://github.com/everzet/jade.php)
- [scala](http://scalate.fusesource.org/versions/snapshot/documentation/scaml-reference.html)
- [ruby](https://github.com/slim-template/slim)
- [python](https://github.com/SyrusAkbary/pyjade)
- [java](https://github.com/neuland/jade4j)
Other:
- [Emacs Mode](https://github.com/brianc/jade-mode)
- [Vim Syntax](https://github.com/digitaltoad/vim-jade)
- [TextMate Bundle](http://github.com/miksago/jade-tmbundle)
- [Coda/SubEtha syntax Mode](https://github.com/aaronmccall/jade.mode)
- [Screencasts](http://tjholowaychuk.com/post/1004255394/jade-screencast-template-engine-for-nodejs)
- [html2jade](https://github.com/donpark/html2jade) converter
- [jade2php](https://github.com/SE7ENSKY/jade2php) converter
- [Jade Server](https://github.com/ded/jade-server) Ideal for building local prototypes apart from any application
## License
MIT

1285
node_modules/jade/Readme_zh-cn.md generated vendored Normal file

File diff suppressed because it is too large Load Diff

295
node_modules/jade/bin/jade.js generated vendored Normal file
View File

@@ -0,0 +1,295 @@
#!/usr/bin/env node
/**
* Module dependencies.
*/
var fs = require('fs')
, program = require('commander')
, path = require('path')
, basename = path.basename
, dirname = path.dirname
, resolve = path.resolve
, normalize = path.normalize
, join = path.join
, mkdirp = require('mkdirp')
, jade = require('../');
// jade options
var options = {};
// options
program
.version(require('../package.json').version)
.usage('[options] [dir|file ...]')
.option('-O, --obj <str|path>', 'JavaScript options object or JSON file containing it')
.option('-o, --out <dir>', 'output the compiled html to <dir>')
.option('-p, --path <path>', 'filename used to resolve includes')
.option('-P, --pretty', 'compile pretty html output')
.option('-c, --client', 'compile function for client-side runtime.js')
.option('-n, --name <str>', 'The name of the compiled template (requires --client)')
.option('-D, --no-debug', 'compile without debugging (smaller functions)')
.option('-w, --watch', 'watch files for changes and automatically re-render')
.option('-E, --extension <ext>', 'specify the output file extension')
.option('-H, --hierarchy', 'keep directory hierarchy when a directory is specified')
.option('--name-after-file', 'Name the template after the last section of the file path (requires --client and overriden by --name)')
.option('--doctype <str>', 'Specify the doctype on the command line (useful if it is not specified by the template)')
program.on('--help', function(){
console.log(' Examples:');
console.log('');
console.log(' # translate jade the templates dir');
console.log(' $ jade templates');
console.log('');
console.log(' # create {foo,bar}.html');
console.log(' $ jade {foo,bar}.jade');
console.log('');
console.log(' # jade over stdio');
console.log(' $ jade < my.jade > my.html');
console.log('');
console.log(' # jade over stdio');
console.log(' $ echo \'h1 Jade!\' | jade');
console.log('');
console.log(' # foo, bar dirs rendering to /tmp');
console.log(' $ jade foo bar --out /tmp ');
console.log('');
});
program.parse(process.argv);
// options given, parse them
if (program.obj) {
options = parseObj(program.obj);
}
/**
* Parse object either in `input` or in the file called `input`. The latter is
* searched first.
*/
function parseObj (input) {
var str, out;
try {
str = fs.readFileSync(program.obj);
} catch (e) {
return eval('(' + program.obj + ')');
}
// We don't want to catch exceptions thrown in JSON.parse() so have to
// use this two-step approach.
return JSON.parse(str);
}
// --path
if (program.path) options.filename = program.path;
// --no-debug
options.compileDebug = program.debug;
// --client
options.client = program.client;
// --pretty
options.pretty = program.pretty;
// --watch
options.watch = program.watch;
// --name
if (typeof program.name === 'string') {
options.name = program.name;
}
// --doctype
options.doctype = program.doctype;
// left-over args are file paths
var files = program.args;
// array of paths that are being watched
var watchList = [];
// function for rendering
var render = program.watch ? tryRender : renderFile;
// compile files
if (files.length) {
console.log();
if (options.watch) {
process.on('SIGINT', function() {
process.exit(1);
});
}
files.forEach(function (file) {
render(file);
});
process.on('exit', function () {
console.log();
});
// stdio
} else {
stdin();
}
/**
* Watch for changes on path
*
* Renders `base` if specified, otherwise renders `path`.
*/
function watchFile(path, base, rootPath) {
path = normalize(path);
if (watchList.indexOf(path) !== -1) return;
console.log(" \033[90mwatching \033[36m%s\033[0m", path);
fs.watchFile(path, {persistent: true, interval: 200},
function (curr, prev) {
// File doesn't exist anymore. Keep watching.
if (curr.mtime.getTime() === 0) return;
// istanbul ignore if
if (curr.mtime.getTime() === prev.mtime.getTime()) return;
tryRender(base || path, rootPath);
});
watchList.push(path);
}
/**
* Convert error to string
*/
function errorToString(e) {
return e.stack || /* istanbul ignore next */ (e.message || e);
}
/**
* Try to render `path`; if an exception is thrown it is printed to stderr and
* otherwise ignored.
*
* This is used in watch mode.
*/
function tryRender(path, rootPath) {
try {
renderFile(path, rootPath);
} catch (e) {
// keep watching when error occured.
console.error(errorToString(e));
}
}
/**
* Compile from stdin.
*/
function stdin() {
var buf = '';
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk){ buf += chunk; });
process.stdin.on('end', function(){
var output;
if (options.client) {
output = jade.compileClient(buf, options);
} else {
var fn = jade.compile(buf, options);
var output = fn(options);
}
process.stdout.write(output);
}).resume();
process.on('SIGINT', function() {
process.stdout.write('\n');
process.stdin.emit('end');
process.stdout.write('\n');
process.exit();
})
}
var hierarchyWarned = false;
/**
* Process the given path, compiling the jade files found.
* Always walk the subdirectories.
*
* @param path path of the file, might be relative
* @param rootPath path relative to the directory specified in the command
*/
function renderFile(path, rootPath) {
var re = /\.jade$/;
var stat = fs.lstatSync(path);
// Found jade file/\.jade$/
if (stat.isFile() && re.test(path)) {
// Try to watch the file if needed. watchFile takes care of duplicates.
if (options.watch) watchFile(path, null, rootPath);
if (program.nameAfterFile) {
options.name = getNameFromFileName(path);
}
var fn = options.client
? jade.compileFileClient(path, options)
: jade.compileFile(path, options);
if (options.watch && fn.dependencies) {
// watch dependencies, and recompile the base
fn.dependencies.forEach(function (dep) {
watchFile(dep, path, rootPath);
});
}
// --extension
var extname;
if (program.extension) extname = '.' + program.extension;
else if (options.client) extname = '.js';
else extname = '.html';
// path: foo.jade -> foo.<ext>
path = path.replace(re, extname);
if (program.out) {
// prepend output directory
if (rootPath && program.hierarchy) {
// replace the rootPath of the resolved path with output directory
path = resolve(path).replace(new RegExp('^' + resolve(rootPath)), '');
path = join(program.out, path);
} else {
if (rootPath && !hierarchyWarned) {
console.warn('In Jade 2.0.0 --hierarchy will become the default.');
hierarchyWarned = true;
}
// old behavior or if no rootPath handling is needed
path = join(program.out, basename(path));
}
}
var dir = resolve(dirname(path));
mkdirp.sync(dir, 0755);
var output = options.client ? fn : fn(options);
fs.writeFileSync(path, output);
console.log(' \033[90mrendered \033[36m%s\033[0m', normalize(path));
// Found directory
} else if (stat.isDirectory()) {
var files = fs.readdirSync(path);
files.map(function(filename) {
return path + '/' + filename;
}).forEach(function (file) {
render(file, rootPath || path);
});
}
}
/**
* Get a sensible name for a template function from a file path
*
* @param {String} filename
* @returns {String}
*/
function getNameFromFileName(filename) {
var file = basename(filename, '.jade');
return file.toLowerCase().replace(/[^a-z0-9]+([a-z])/g, function (_, character) {
return character.toUpperCase();
}) + 'Template';
}

0
node_modules/jade/block-code.html generated vendored Normal file
View File

16
node_modules/jade/component.json generated vendored Normal file
View File

@@ -0,0 +1,16 @@
{
"name": "jade",
"repo": "visionmedia/jade",
"description": "Jade template runtime",
"version": "1.11.0",
"keywords": [
"template"
],
"dependencies": {},
"development": {},
"license": "MIT",
"scripts": [
"lib/runtime.js"
],
"main": "lib/runtime.js"
}

9196
node_modules/jade/jade.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

723
node_modules/jade/lib/compiler.js generated vendored Normal file
View File

@@ -0,0 +1,723 @@
'use strict';
var nodes = require('./nodes');
var filters = require('./filters');
var doctypes = require('./doctypes');
var runtime = require('./runtime');
var utils = require('./utils');
var selfClosing = require('void-elements');
var parseJSExpression = require('character-parser').parseMax;
var constantinople = require('constantinople');
function isConstant(src) {
return constantinople(src, {jade: runtime, 'jade_interp': undefined});
}
function toConstant(src) {
return constantinople.toConstant(src, {jade: runtime, 'jade_interp': undefined});
}
function errorAtNode(node, error) {
error.line = node.line;
error.filename = node.filename;
return error;
}
/**
* Initialize `Compiler` with the given `node`.
*
* @param {Node} node
* @param {Object} options
* @api public
*/
var Compiler = module.exports = function Compiler(node, options) {
this.options = options = options || {};
this.node = node;
this.hasCompiledDoctype = false;
this.hasCompiledTag = false;
this.pp = options.pretty || false;
if (this.pp && typeof this.pp !== 'string') {
this.pp = ' ';
}
this.debug = false !== options.compileDebug;
this.indents = 0;
this.parentIndents = 0;
this.terse = false;
this.mixins = {};
this.dynamicMixins = false;
if (options.doctype) this.setDoctype(options.doctype);
};
/**
* Compiler prototype.
*/
Compiler.prototype = {
/**
* Compile parse tree to JavaScript.
*
* @api public
*/
compile: function(){
this.buf = [];
if (this.pp) this.buf.push("var jade_indent = [];");
this.lastBufferedIdx = -1;
this.visit(this.node);
if (!this.dynamicMixins) {
// if there are no dynamic mixins we can remove any un-used mixins
var mixinNames = Object.keys(this.mixins);
for (var i = 0; i < mixinNames.length; i++) {
var mixin = this.mixins[mixinNames[i]];
if (!mixin.used) {
for (var x = 0; x < mixin.instances.length; x++) {
for (var y = mixin.instances[x].start; y < mixin.instances[x].end; y++) {
this.buf[y] = '';
}
}
}
}
}
return this.buf.join('\n');
},
/**
* Sets the default doctype `name`. Sets terse mode to `true` when
* html 5 is used, causing self-closing tags to end with ">" vs "/>",
* and boolean attributes are not mirrored.
*
* @param {string} name
* @api public
*/
setDoctype: function(name){
this.doctype = doctypes[name.toLowerCase()] || '<!DOCTYPE ' + name + '>';
this.terse = this.doctype.toLowerCase() == '<!doctype html>';
this.xml = 0 == this.doctype.indexOf('<?xml');
},
/**
* Buffer the given `str` exactly as is or with interpolation
*
* @param {String} str
* @param {Boolean} interpolate
* @api public
*/
buffer: function (str, interpolate) {
var self = this;
if (interpolate) {
var match = /(\\)?([#!]){((?:.|\n)*)$/.exec(str);
if (match) {
this.buffer(str.substr(0, match.index), false);
if (match[1]) { // escape
this.buffer(match[2] + '{', false);
this.buffer(match[3], true);
return;
} else {
var rest = match[3];
var range = parseJSExpression(rest);
var code = ('!' == match[2] ? '' : 'jade.escape') + "((jade_interp = " + range.src + ") == null ? '' : jade_interp)";
this.bufferExpression(code);
this.buffer(rest.substr(range.end + 1), true);
return;
}
}
}
str = utils.stringify(str);
str = str.substr(1, str.length - 2);
if (this.lastBufferedIdx == this.buf.length) {
if (this.lastBufferedType === 'code') this.lastBuffered += ' + "';
this.lastBufferedType = 'text';
this.lastBuffered += str;
this.buf[this.lastBufferedIdx - 1] = 'buf.push(' + this.bufferStartChar + this.lastBuffered + '");'
} else {
this.buf.push('buf.push("' + str + '");');
this.lastBufferedType = 'text';
this.bufferStartChar = '"';
this.lastBuffered = str;
this.lastBufferedIdx = this.buf.length;
}
},
/**
* Buffer the given `src` so it is evaluated at run time
*
* @param {String} src
* @api public
*/
bufferExpression: function (src) {
if (isConstant(src)) {
return this.buffer(toConstant(src) + '', false)
}
if (this.lastBufferedIdx == this.buf.length) {
if (this.lastBufferedType === 'text') this.lastBuffered += '"';
this.lastBufferedType = 'code';
this.lastBuffered += ' + (' + src + ')';
this.buf[this.lastBufferedIdx - 1] = 'buf.push(' + this.bufferStartChar + this.lastBuffered + ');'
} else {
this.buf.push('buf.push(' + src + ');');
this.lastBufferedType = 'code';
this.bufferStartChar = '';
this.lastBuffered = '(' + src + ')';
this.lastBufferedIdx = this.buf.length;
}
},
/**
* Buffer an indent based on the current `indent`
* property and an additional `offset`.
*
* @param {Number} offset
* @param {Boolean} newline
* @api public
*/
prettyIndent: function(offset, newline){
offset = offset || 0;
newline = newline ? '\n' : '';
this.buffer(newline + Array(this.indents + offset).join(this.pp));
if (this.parentIndents)
this.buf.push("buf.push.apply(buf, jade_indent);");
},
/**
* Visit `node`.
*
* @param {Node} node
* @api public
*/
visit: function(node){
var debug = this.debug;
if (debug) {
this.buf.push('jade_debug.unshift(new jade.DebugItem( ' + node.line
+ ', ' + (node.filename
? utils.stringify(node.filename)
: 'jade_debug[0].filename')
+ ' ));');
}
// Massive hack to fix our context
// stack for - else[ if] etc
if (false === node.debug && this.debug) {
this.buf.pop();
this.buf.pop();
}
this.visitNode(node);
if (debug) this.buf.push('jade_debug.shift();');
},
/**
* Visit `node`.
*
* @param {Node} node
* @api public
*/
visitNode: function(node){
return this['visit' + node.type](node);
},
/**
* Visit case `node`.
*
* @param {Literal} node
* @api public
*/
visitCase: function(node){
var _ = this.withinCase;
this.withinCase = true;
this.buf.push('switch (' + node.expr + '){');
this.visit(node.block);
this.buf.push('}');
this.withinCase = _;
},
/**
* Visit when `node`.
*
* @param {Literal} node
* @api public
*/
visitWhen: function(node){
if ('default' == node.expr) {
this.buf.push('default:');
} else {
this.buf.push('case ' + node.expr + ':');
}
if (node.block) {
this.visit(node.block);
this.buf.push(' break;');
}
},
/**
* Visit literal `node`.
*
* @param {Literal} node
* @api public
*/
visitLiteral: function(node){
this.buffer(node.str);
},
/**
* Visit all nodes in `block`.
*
* @param {Block} block
* @api public
*/
visitBlock: function(block){
var len = block.nodes.length
, escape = this.escape
, pp = this.pp
// Pretty print multi-line text
if (pp && len > 1 && !escape && block.nodes[0].isText && block.nodes[1].isText)
this.prettyIndent(1, true);
for (var i = 0; i < len; ++i) {
// Pretty print text
if (pp && i > 0 && !escape && block.nodes[i].isText && block.nodes[i-1].isText)
this.prettyIndent(1, false);
this.visit(block.nodes[i]);
// Multiple text nodes are separated by newlines
if (block.nodes[i+1] && block.nodes[i].isText && block.nodes[i+1].isText)
this.buffer('\n');
}
},
/**
* Visit a mixin's `block` keyword.
*
* @param {MixinBlock} block
* @api public
*/
visitMixinBlock: function(block){
if (this.pp) this.buf.push("jade_indent.push('" + Array(this.indents + 1).join(this.pp) + "');");
this.buf.push('block && block();');
if (this.pp) this.buf.push("jade_indent.pop();");
},
/**
* Visit `doctype`. Sets terse mode to `true` when html 5
* is used, causing self-closing tags to end with ">" vs "/>",
* and boolean attributes are not mirrored.
*
* @param {Doctype} doctype
* @api public
*/
visitDoctype: function(doctype){
if (doctype && (doctype.val || !this.doctype)) {
this.setDoctype(doctype.val || 'default');
}
if (this.doctype) this.buffer(this.doctype);
this.hasCompiledDoctype = true;
},
/**
* Visit `mixin`, generating a function that
* may be called within the template.
*
* @param {Mixin} mixin
* @api public
*/
visitMixin: function(mixin){
var name = 'jade_mixins[';
var args = mixin.args || '';
var block = mixin.block;
var attrs = mixin.attrs;
var attrsBlocks = mixin.attributeBlocks.slice();
var pp = this.pp;
var dynamic = mixin.name[0]==='#';
var key = mixin.name;
if (dynamic) this.dynamicMixins = true;
name += (dynamic ? mixin.name.substr(2,mixin.name.length-3):'"'+mixin.name+'"')+']';
this.mixins[key] = this.mixins[key] || {used: false, instances: []};
if (mixin.call) {
this.mixins[key].used = true;
if (pp) this.buf.push("jade_indent.push('" + Array(this.indents + 1).join(pp) + "');")
if (block || attrs.length || attrsBlocks.length) {
this.buf.push(name + '.call({');
if (block) {
this.buf.push('block: function(){');
// Render block with no indents, dynamically added when rendered
this.parentIndents++;
var _indents = this.indents;
this.indents = 0;
this.visit(mixin.block);
this.indents = _indents;
this.parentIndents--;
if (attrs.length || attrsBlocks.length) {
this.buf.push('},');
} else {
this.buf.push('}');
}
}
if (attrsBlocks.length) {
if (attrs.length) {
var val = this.attrs(attrs);
attrsBlocks.unshift(val);
}
this.buf.push('attributes: jade.merge([' + attrsBlocks.join(',') + '])');
} else if (attrs.length) {
var val = this.attrs(attrs);
this.buf.push('attributes: ' + val);
}
if (args) {
this.buf.push('}, ' + args + ');');
} else {
this.buf.push('});');
}
} else {
this.buf.push(name + '(' + args + ');');
}
if (pp) this.buf.push("jade_indent.pop();")
} else {
var mixin_start = this.buf.length;
args = args ? args.split(',') : [];
var rest;
if (args.length && /^\.\.\./.test(args[args.length - 1].trim())) {
rest = args.pop().trim().replace(/^\.\.\./, '');
}
// we need use jade_interp here for v8: https://code.google.com/p/v8/issues/detail?id=4165
// once fixed, use this: this.buf.push(name + ' = function(' + args.join(',') + '){');
this.buf.push(name + ' = jade_interp = function(' + args.join(',') + '){');
this.buf.push('var block = (this && this.block), attributes = (this && this.attributes) || {};');
if (rest) {
this.buf.push('var ' + rest + ' = [];');
this.buf.push('for (jade_interp = ' + args.length + '; jade_interp < arguments.length; jade_interp++) {');
this.buf.push(' ' + rest + '.push(arguments[jade_interp]);');
this.buf.push('}');
}
this.parentIndents++;
this.visit(block);
this.parentIndents--;
this.buf.push('};');
var mixin_end = this.buf.length;
this.mixins[key].instances.push({start: mixin_start, end: mixin_end});
}
},
/**
* Visit `tag` buffering tag markup, generating
* attributes, visiting the `tag`'s code and block.
*
* @param {Tag} tag
* @api public
*/
visitTag: function(tag){
this.indents++;
var name = tag.name
, pp = this.pp
, self = this;
function bufferName() {
if (tag.buffer) self.bufferExpression(name);
else self.buffer(name);
}
if ('pre' == tag.name) this.escape = true;
if (!this.hasCompiledTag) {
if (!this.hasCompiledDoctype && 'html' == name) {
this.visitDoctype();
}
this.hasCompiledTag = true;
}
// pretty print
if (pp && !tag.isInline())
this.prettyIndent(0, true);
if (tag.selfClosing || (!this.xml && selfClosing[tag.name])) {
this.buffer('<');
bufferName();
this.visitAttributes(tag.attrs, tag.attributeBlocks.slice());
this.terse
? this.buffer('>')
: this.buffer('/>');
// if it is non-empty throw an error
if (tag.block &&
!(tag.block.type === 'Block' && tag.block.nodes.length === 0) &&
tag.block.nodes.some(function (tag) {
return tag.type !== 'Text' || !/^\s*$/.test(tag.val)
})) {
throw errorAtNode(tag, new Error(name + ' is self closing and should not have content.'));
}
} else {
// Optimize attributes buffering
this.buffer('<');
bufferName();
this.visitAttributes(tag.attrs, tag.attributeBlocks.slice());
this.buffer('>');
if (tag.code) this.visitCode(tag.code);
this.visit(tag.block);
// pretty print
if (pp && !tag.isInline() && 'pre' != tag.name && !tag.canInline())
this.prettyIndent(0, true);
this.buffer('</');
bufferName();
this.buffer('>');
}
if ('pre' == tag.name) this.escape = false;
this.indents--;
},
/**
* Visit `filter`, throwing when the filter does not exist.
*
* @param {Filter} filter
* @api public
*/
visitFilter: function(filter){
var text = filter.block.nodes.map(
function(node){ return node.val; }
).join('\n');
filter.attrs.filename = this.options.filename;
try {
this.buffer(filters(filter.name, text, filter.attrs), true);
} catch (err) {
throw errorAtNode(filter, err);
}
},
/**
* Visit `text` node.
*
* @param {Text} text
* @api public
*/
visitText: function(text){
this.buffer(text.val, true);
},
/**
* Visit a `comment`, only buffering when the buffer flag is set.
*
* @param {Comment} comment
* @api public
*/
visitComment: function(comment){
if (!comment.buffer) return;
if (this.pp) this.prettyIndent(1, true);
this.buffer('<!--' + comment.val + '-->');
},
/**
* Visit a `BlockComment`.
*
* @param {Comment} comment
* @api public
*/
visitBlockComment: function(comment){
if (!comment.buffer) return;
if (this.pp) this.prettyIndent(1, true);
this.buffer('<!--' + comment.val);
this.visit(comment.block);
if (this.pp) this.prettyIndent(1, true);
this.buffer('-->');
},
/**
* Visit `code`, respecting buffer / escape flags.
* If the code is followed by a block, wrap it in
* a self-calling function.
*
* @param {Code} code
* @api public
*/
visitCode: function(code){
// Wrap code blocks with {}.
// we only wrap unbuffered code blocks ATM
// since they are usually flow control
// Buffer code
if (code.buffer) {
var val = code.val.trim();
val = 'null == (jade_interp = '+val+') ? "" : jade_interp';
if (code.escape) val = 'jade.escape(' + val + ')';
this.bufferExpression(val);
} else {
this.buf.push(code.val);
}
// Block support
if (code.block) {
if (!code.buffer) this.buf.push('{');
this.visit(code.block);
if (!code.buffer) this.buf.push('}');
}
},
/**
* Visit `each` block.
*
* @param {Each} each
* @api public
*/
visitEach: function(each){
this.buf.push(''
+ '// iterate ' + each.obj + '\n'
+ ';(function(){\n'
+ ' var $$obj = ' + each.obj + ';\n'
+ ' if (\'number\' == typeof $$obj.length) {\n');
if (each.alternative) {
this.buf.push(' if ($$obj.length) {');
}
this.buf.push(''
+ ' for (var ' + each.key + ' = 0, $$l = $$obj.length; ' + each.key + ' < $$l; ' + each.key + '++) {\n'
+ ' var ' + each.val + ' = $$obj[' + each.key + '];\n');
this.visit(each.block);
this.buf.push(' }\n');
if (each.alternative) {
this.buf.push(' } else {');
this.visit(each.alternative);
this.buf.push(' }');
}
this.buf.push(''
+ ' } else {\n'
+ ' var $$l = 0;\n'
+ ' for (var ' + each.key + ' in $$obj) {\n'
+ ' $$l++;'
+ ' var ' + each.val + ' = $$obj[' + each.key + '];\n');
this.visit(each.block);
this.buf.push(' }\n');
if (each.alternative) {
this.buf.push(' if ($$l === 0) {');
this.visit(each.alternative);
this.buf.push(' }');
}
this.buf.push(' }\n}).call(this);\n');
},
/**
* Visit `attrs`.
*
* @param {Array} attrs
* @api public
*/
visitAttributes: function(attrs, attributeBlocks){
if (attributeBlocks.length) {
if (attrs.length) {
var val = this.attrs(attrs);
attributeBlocks.unshift(val);
}
this.bufferExpression('jade.attrs(jade.merge([' + attributeBlocks.join(',') + ']), ' + utils.stringify(this.terse) + ')');
} else if (attrs.length) {
this.attrs(attrs, true);
}
},
/**
* Compile attributes.
*/
attrs: function(attrs, buffer){
var buf = [];
var classes = [];
var classEscaping = [];
attrs.forEach(function(attr){
var key = attr.name;
var escaped = attr.escaped;
if (key === 'class') {
classes.push(attr.val);
classEscaping.push(attr.escaped);
} else if (isConstant(attr.val)) {
if (buffer) {
this.buffer(runtime.attr(key, toConstant(attr.val), escaped, this.terse));
} else {
var val = toConstant(attr.val);
if (key === 'style') val = runtime.style(val);
if (escaped && !(key.indexOf('data') === 0 && typeof val !== 'string')) {
val = runtime.escape(val);
}
buf.push(utils.stringify(key) + ': ' + utils.stringify(val));
}
} else {
if (buffer) {
this.bufferExpression('jade.attr("' + key + '", ' + attr.val + ', ' + utils.stringify(escaped) + ', ' + utils.stringify(this.terse) + ')');
} else {
var val = attr.val;
if (key === 'style') {
val = 'jade.style(' + val + ')';
}
if (escaped && !(key.indexOf('data') === 0)) {
val = 'jade.escape(' + val + ')';
} else if (escaped) {
val = '(typeof (jade_interp = ' + val + ') == "string" ? jade.escape(jade_interp) : jade_interp)';
}
buf.push(utils.stringify(key) + ': ' + val);
}
}
}.bind(this));
if (buffer) {
if (classes.every(isConstant)) {
this.buffer(runtime.cls(classes.map(toConstant), classEscaping));
} else {
this.bufferExpression('jade.cls([' + classes.join(',') + '], ' + utils.stringify(classEscaping) + ')');
}
} else if (classes.length) {
if (classes.every(isConstant)) {
classes = utils.stringify(runtime.joinClasses(classes.map(toConstant).map(runtime.joinClasses).map(function (cls, i) {
return classEscaping[i] ? runtime.escape(cls) : cls;
})));
} else {
classes = '(jade_interp = ' + utils.stringify(classEscaping) + ',' +
' jade.joinClasses([' + classes.join(',') + '].map(jade.joinClasses).map(function (cls, i) {' +
' return jade_interp[i] ? jade.escape(cls) : cls' +
' }))' +
')';
}
if (classes.length)
buf.push('"class": ' + classes);
}
return '{' + buf.join(',') + '}';
}
};

12
node_modules/jade/lib/doctypes.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
'use strict';
module.exports = {
'default': '<!DOCTYPE html>'
, 'xml': '<?xml version="1.0" encoding="utf-8" ?>'
, 'transitional': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
, 'strict': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
, 'frameset': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">'
, '1.1': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'
, 'basic': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">'
, 'mobile': '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">'
};

10
node_modules/jade/lib/filters-client.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
'use strict';
module.exports = filter;
function filter(name, str, options) {
if (typeof filter[name] === 'function') {
return filter[name](str, options);
} else {
throw new Error('unknown filter ":' + name + '"');
}
}

96
node_modules/jade/lib/filters.js generated vendored Normal file
View File

@@ -0,0 +1,96 @@
'use strict';
var transformers = require('transformers');
var jstransformer = require('jstransformer');
var uglify = require('uglify-js');
var CleanCSS = require('clean-css');
var warned = {};
var alternatives = {
uglifyJS: 'uglify-js',
uglify: 'uglify-js',
uglifyCSS: 'clean-css',
'uglify-css': 'clean-css' ,
uglifyJSON: 'json',
'uglify-json': 'json',
live: 'livescript',
LiveScript: 'livescript',
ls: 'livescript',
// TODO: remove if we add support for coffeekup
coffeekup: 'coffeecup',
// The `style` transformer is not the same as the `stylus` jstransformer
styl: 'stylus',
coffee: 'coffee-script',
coffeescript: 'coffee-script',
coffeeScript: 'coffee-script',
// these marker transformers haven't made sense in a long time
css: 'verbatim',
js: 'verbatim',
};
var deprecated = ['jqtpl', 'jazz'];
function getMarkdownImplementation() {
var implementations = ['marked', 'supermarked', 'markdown-js', 'markdown'];
while (implementations.length) {
try {
require(implementations[0]);
return implementations[0];
} catch (ex) {
implementations.shift();
}
}
return 'markdown-it';
}
module.exports = filter;
function filter(name, str, options) {
if (typeof filter[name] === 'function') {
return filter[name](str, options);
} else {
var tr;
try {
tr = jstransformer(require('jstransformer-' + name));
} catch (ex) {}
if (tr) {
// TODO: we may want to add a way for people to separately specify "locals"
var result = tr.render(str, options, options).body;
if (options && options.minify) {
try {
switch (tr.outputFormat) {
case 'js':
result = uglify.minify(result, {fromString: true}).code;
break;
case 'css':
result = new CleanCSS().minify(result).styles;
break;
}
} catch (ex) {
// better to fail to minify than output nothing
}
}
return result;
} else if (transformers[name]) {
if (!warned[name]) {
warned[name] = true;
if (name === 'md' || name === 'markdown') {
var implementation = getMarkdownImplementation();
console.log('Transformers.' + name + ' is deprecated, you must replace the :' +
name + ' jade filter, with :' +
implementation + ' and install jstransformer-' +
implementation + ' before you update to jade@2.0.0.');
} else if (alternatives[name]) {
console.log('Transformers.' + name + ' is deprecated, you must replace the :' +
name + ' jade filter, with :' +
alternatives[name] + ' and install jstransformer-' +
alternatives[name] + ' before you update to jade@2.0.0.');
} else {
console.log('Transformers.' + name + ' is deprecated, to continue using the :' +
name + ' jade filter after jade@2.0.0, you will need to install jstransformer-' +
name.toLowerCase() + '.');
}
}
return transformers[name].renderSync(str, options);
} else {
throw new Error('unknown filter ":' + name + '"');
}
}
}

418
node_modules/jade/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,418 @@
'use strict';
/*!
* Jade
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
/**
* Module dependencies.
*/
var Parser = require('./parser')
, Lexer = require('./lexer')
, Compiler = require('./compiler')
, runtime = require('./runtime')
, addWith = require('with')
, fs = require('fs')
, utils = require('./utils');
/**
* Expose self closing tags.
*/
// FIXME: either stop exporting selfClosing in v2 or export the new object
// form
exports.selfClosing = Object.keys(require('void-elements'));
/**
* Default supported doctypes.
*/
exports.doctypes = require('./doctypes');
/**
* Text filters.
*/
exports.filters = require('./filters');
/**
* Utilities.
*/
exports.utils = utils;
/**
* Expose `Compiler`.
*/
exports.Compiler = Compiler;
/**
* Expose `Parser`.
*/
exports.Parser = Parser;
/**
* Expose `Lexer`.
*/
exports.Lexer = Lexer;
/**
* Nodes.
*/
exports.nodes = require('./nodes');
/**
* Jade runtime helpers.
*/
exports.runtime = runtime;
/**
* Template function cache.
*/
exports.cache = {};
/**
* Parse the given `str` of jade and return a function body.
*
* @param {String} str
* @param {Object} options
* @return {Object}
* @api private
*/
function parse(str, options){
if (options.lexer) {
console.warn('Using `lexer` as a local in render() is deprecated and '
+ 'will be interpreted as an option in Jade 2.0.0');
}
// Parse
var parser = new (options.parser || Parser)(str, options.filename, options);
var tokens;
try {
// Parse
tokens = parser.parse();
} catch (err) {
parser = parser.context();
runtime.rethrow(err, parser.filename, parser.lexer.lineno, parser.input);
}
// Compile
var compiler = new (options.compiler || Compiler)(tokens, options);
var js;
try {
js = compiler.compile();
} catch (err) {
if (err.line && (err.filename || !options.filename)) {
runtime.rethrow(err, err.filename, err.line, parser.input);
} else {
if (err instanceof Error) {
err.message += '\n\nPlease report this entire error and stack trace to https://github.com/jadejs/jade/issues';
}
throw err;
}
}
// Debug compiler
if (options.debug) {
console.error('\nCompiled Function:\n\n\u001b[90m%s\u001b[0m', js.replace(/^/gm, ' '));
}
var globals = [];
if (options.globals) {
globals = options.globals.slice();
}
globals.push('jade');
globals.push('jade_mixins');
globals.push('jade_interp');
globals.push('jade_debug');
globals.push('buf');
var body = ''
+ 'var buf = [];\n'
+ 'var jade_mixins = {};\n'
+ 'var jade_interp;\n'
+ (options.self
? 'var self = locals || {};\n' + js
: addWith('locals || {}', '\n' + js, globals)) + ';'
+ 'return buf.join("");';
return {body: body, dependencies: parser.dependencies};
}
/**
* Get the template from a string or a file, either compiled on-the-fly or
* read from cache (if enabled), and cache the template if needed.
*
* If `str` is not set, the file specified in `options.filename` will be read.
*
* If `options.cache` is true, this function reads the file from
* `options.filename` so it must be set prior to calling this function.
*
* @param {Object} options
* @param {String=} str
* @return {Function}
* @api private
*/
function handleTemplateCache (options, str) {
var key = options.filename;
if (options.cache && exports.cache[key]) {
return exports.cache[key];
} else {
if (str === undefined) str = fs.readFileSync(options.filename, 'utf8');
var templ = exports.compile(str, options);
if (options.cache) exports.cache[key] = templ;
return templ;
}
}
/**
* Compile a `Function` representation of the given jade `str`.
*
* Options:
*
* - `compileDebug` when `false` debugging code is stripped from the compiled
template, when it is explicitly `true`, the source code is included in
the compiled template for better accuracy.
* - `filename` used to improve errors when `compileDebug` is not `false` and to resolve imports/extends
*
* @param {String} str
* @param {Options} options
* @return {Function}
* @api public
*/
exports.compile = function(str, options){
var options = options || {}
, filename = options.filename
? utils.stringify(options.filename)
: 'undefined'
, fn;
str = String(str);
var parsed = parse(str, options);
if (options.compileDebug !== false) {
fn = [
'var jade_debug = [ new jade.DebugItem( 1, ' + filename + ' ) ];'
, 'try {'
, parsed.body
, '} catch (err) {'
, ' jade.rethrow(err, jade_debug[0].filename, jade_debug[0].lineno' + (options.compileDebug === true ? ',' + utils.stringify(str) : '') + ');'
, '}'
].join('\n');
} else {
fn = parsed.body;
}
fn = new Function('locals, jade', fn)
var res = function(locals){ return fn(locals, Object.create(runtime)) };
if (options.client) {
res.toString = function () {
var err = new Error('The `client` option is deprecated, use the `jade.compileClient` method instead');
err.name = 'Warning';
console.error(err.stack || /* istanbul ignore next */ err.message);
return exports.compileClient(str, options);
};
}
res.dependencies = parsed.dependencies;
return res;
};
/**
* Compile a JavaScript source representation of the given jade `str`.
*
* Options:
*
* - `compileDebug` When it is `true`, the source code is included in
* the compiled template for better error messages.
* - `filename` used to improve errors when `compileDebug` is not `true` and to resolve imports/extends
* - `name` the name of the resulting function (defaults to "template")
*
* @param {String} str
* @param {Options} options
* @return {Object}
* @api public
*/
exports.compileClientWithDependenciesTracked = function(str, options){
var options = options || {};
var name = options.name || 'template';
var filename = options.filename ? utils.stringify(options.filename) : 'undefined';
var fn;
str = String(str);
options.compileDebug = options.compileDebug ? true : false;
var parsed = parse(str, options);
if (options.compileDebug) {
fn = [
'var jade_debug = [ new jade.DebugItem( 1, ' + filename + ' ) ];'
, 'try {'
, parsed.body
, '} catch (err) {'
, ' jade.rethrow(err, jade_debug[0].filename, jade_debug[0].lineno, ' + utils.stringify(str) + ');'
, '}'
].join('\n');
} else {
fn = parsed.body;
}
return {body: 'function ' + name + '(locals) {\n' + fn + '\n}', dependencies: parsed.dependencies};
};
/**
* Compile a JavaScript source representation of the given jade `str`.
*
* Options:
*
* - `compileDebug` When it is `true`, the source code is included in
* the compiled template for better error messages.
* - `filename` used to improve errors when `compileDebug` is not `true` and to resolve imports/extends
* - `name` the name of the resulting function (defaults to "template")
*
* @param {String} str
* @param {Options} options
* @return {String}
* @api public
*/
exports.compileClient = function (str, options) {
return exports.compileClientWithDependenciesTracked(str, options).body;
};
/**
* Compile a `Function` representation of the given jade file.
*
* Options:
*
* - `compileDebug` when `false` debugging code is stripped from the compiled
template, when it is explicitly `true`, the source code is included in
the compiled template for better accuracy.
*
* @param {String} path
* @param {Options} options
* @return {Function}
* @api public
*/
exports.compileFile = function (path, options) {
options = options || {};
options.filename = path;
return handleTemplateCache(options);
};
/**
* Render the given `str` of jade.
*
* Options:
*
* - `cache` enable template caching
* - `filename` filename required for `include` / `extends` and caching
*
* @param {String} str
* @param {Object|Function} options or fn
* @param {Function|undefined} fn
* @returns {String}
* @api public
*/
exports.render = function(str, options, fn){
// support callback API
if ('function' == typeof options) {
fn = options, options = undefined;
}
if (typeof fn === 'function') {
var res
try {
res = exports.render(str, options);
} catch (ex) {
return fn(ex);
}
return fn(null, res);
}
options = options || {};
// cache requires .filename
if (options.cache && !options.filename) {
throw new Error('the "filename" option is required for caching');
}
return handleTemplateCache(options, str)(options);
};
/**
* Render a Jade file at the given `path`.
*
* @param {String} path
* @param {Object|Function} options or callback
* @param {Function|undefined} fn
* @returns {String}
* @api public
*/
exports.renderFile = function(path, options, fn){
// support callback API
if ('function' == typeof options) {
fn = options, options = undefined;
}
if (typeof fn === 'function') {
var res
try {
res = exports.renderFile(path, options);
} catch (ex) {
return fn(ex);
}
return fn(null, res);
}
options = options || {};
options.filename = path;
return handleTemplateCache(options)(options);
};
/**
* Compile a Jade file at the given `path` for use on the client.
*
* @param {String} path
* @param {Object} options
* @returns {String}
* @api public
*/
exports.compileFileClient = function(path, options){
var key = path + ':client';
options = options || {};
options.filename = path;
if (options.cache && exports.cache[key]) {
return exports.cache[key];
}
var str = fs.readFileSync(options.filename, 'utf8');
var out = exports.compileClient(str, options);
if (options.cache) exports.cache[key] = out;
return out;
};
/**
* Express support.
*/
exports.__express = function(path, options, fn) {
if(options.compileDebug == undefined && process.env.NODE_ENV === 'production') {
options.compileDebug = false;
}
exports.renderFile(path, options, fn);
}

23
node_modules/jade/lib/inline-tags.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
'use strict';
module.exports = [
'a'
, 'abbr'
, 'acronym'
, 'b'
, 'br'
, 'code'
, 'em'
, 'font'
, 'i'
, 'img'
, 'ins'
, 'kbd'
, 'map'
, 'samp'
, 'small'
, 'span'
, 'strong'
, 'sub'
, 'sup'
];

949
node_modules/jade/lib/lexer.js generated vendored Normal file
View File

@@ -0,0 +1,949 @@
'use strict';
var utils = require('./utils');
var characterParser = require('character-parser');
/**
* Initialize `Lexer` with the given `str`.
*
* @param {String} str
* @param {String} filename
* @api private
*/
var Lexer = module.exports = function Lexer(str, filename) {
this.input = str.replace(/\r\n|\r/g, '\n');
this.filename = filename;
this.deferredTokens = [];
this.lastIndents = 0;
this.lineno = 1;
this.stash = [];
this.indentStack = [];
this.indentRe = null;
this.pipeless = false;
};
function assertExpression(exp) {
//this verifies that a JavaScript expression is valid
Function('', 'return (' + exp + ')');
}
function assertNestingCorrect(exp) {
//this verifies that code is properly nested, but allows
//invalid JavaScript such as the contents of `attributes`
var res = characterParser(exp)
if (res.isNesting()) {
throw new Error('Nesting must match on expression `' + exp + '`')
}
}
/**
* Lexer prototype.
*/
Lexer.prototype = {
/**
* Construct a token with the given `type` and `val`.
*
* @param {String} type
* @param {String} val
* @return {Object}
* @api private
*/
tok: function(type, val){
return {
type: type
, line: this.lineno
, val: val
}
},
/**
* Consume the given `len` of input.
*
* @param {Number} len
* @api private
*/
consume: function(len){
this.input = this.input.substr(len);
},
/**
* Scan for `type` with the given `regexp`.
*
* @param {String} type
* @param {RegExp} regexp
* @return {Object}
* @api private
*/
scan: function(regexp, type){
var captures;
if (captures = regexp.exec(this.input)) {
this.consume(captures[0].length);
return this.tok(type, captures[1]);
}
},
/**
* Defer the given `tok`.
*
* @param {Object} tok
* @api private
*/
defer: function(tok){
this.deferredTokens.push(tok);
},
/**
* Lookahead `n` tokens.
*
* @param {Number} n
* @return {Object}
* @api private
*/
lookahead: function(n){
var fetch = n - this.stash.length;
while (fetch-- > 0) this.stash.push(this.next());
return this.stash[--n];
},
/**
* Return the indexOf `(` or `{` or `[` / `)` or `}` or `]` delimiters.
*
* @return {Number}
* @api private
*/
bracketExpression: function(skip){
skip = skip || 0;
var start = this.input[skip];
if (start != '(' && start != '{' && start != '[') throw new Error('unrecognized start character');
var end = ({'(': ')', '{': '}', '[': ']'})[start];
var range = characterParser.parseMax(this.input, {start: skip + 1});
if (this.input[range.end] !== end) throw new Error('start character ' + start + ' does not match end character ' + this.input[range.end]);
return range;
},
/**
* Stashed token.
*/
stashed: function() {
return this.stash.length
&& this.stash.shift();
},
/**
* Deferred token.
*/
deferred: function() {
return this.deferredTokens.length
&& this.deferredTokens.shift();
},
/**
* end-of-source.
*/
eos: function() {
if (this.input.length) return;
if (this.indentStack.length) {
this.indentStack.shift();
return this.tok('outdent');
} else {
return this.tok('eos');
}
},
/**
* Blank line.
*/
blank: function() {
var captures;
if (captures = /^\n *\n/.exec(this.input)) {
this.consume(captures[0].length - 1);
++this.lineno;
if (this.pipeless) return this.tok('text', '');
return this.next();
}
},
/**
* Comment.
*/
comment: function() {
var captures;
if (captures = /^\/\/(-)?([^\n]*)/.exec(this.input)) {
this.consume(captures[0].length);
var tok = this.tok('comment', captures[2]);
tok.buffer = '-' != captures[1];
this.pipeless = true;
return tok;
}
},
/**
* Interpolated tag.
*/
interpolation: function() {
if (/^#\{/.test(this.input)) {
var match = this.bracketExpression(1);
this.consume(match.end + 1);
return this.tok('interpolation', match.src);
}
},
/**
* Tag.
*/
tag: function() {
var captures;
if (captures = /^(\w[-:\w]*)(\/?)/.exec(this.input)) {
this.consume(captures[0].length);
var tok, name = captures[1];
if (':' == name[name.length - 1]) {
name = name.slice(0, -1);
tok = this.tok('tag', name);
this.defer(this.tok(':'));
if (this.input[0] !== ' ') {
console.warn('Warning: space required after `:` on line ' + this.lineno +
' of jade file "' + this.filename + '"');
}
while (' ' == this.input[0]) this.input = this.input.substr(1);
} else {
tok = this.tok('tag', name);
}
tok.selfClosing = !!captures[2];
return tok;
}
},
/**
* Filter.
*/
filter: function() {
var tok = this.scan(/^:([\w\-]+)/, 'filter');
if (tok) {
this.pipeless = true;
return tok;
}
},
/**
* Doctype.
*/
doctype: function() {
if (this.scan(/^!!! *([^\n]+)?/, 'doctype')) {
throw new Error('`!!!` is deprecated, you must now use `doctype`');
}
var node = this.scan(/^(?:doctype) *([^\n]+)?/, 'doctype');
if (node && node.val && node.val.trim() === '5') {
throw new Error('`doctype 5` is deprecated, you must now use `doctype html`');
}
return node;
},
/**
* Id.
*/
id: function() {
return this.scan(/^#([\w-]+)/, 'id');
},
/**
* Class.
*/
className: function() {
return this.scan(/^\.([\w-]+)/, 'class');
},
/**
* Text.
*/
text: function() {
return this.scan(/^(?:\| ?| )([^\n]+)/, 'text') ||
this.scan(/^\|?( )/, 'text') ||
this.scan(/^(<[^\n]*)/, 'text');
},
textFail: function () {
var tok;
if (tok = this.scan(/^([^\.\n][^\n]+)/, 'text')) {
console.warn('Warning: missing space before text for line ' + this.lineno +
' of jade file "' + this.filename + '"');
return tok;
}
},
/**
* Dot.
*/
dot: function() {
var match;
if (match = this.scan(/^\./, 'dot')) {
this.pipeless = true;
return match;
}
},
/**
* Extends.
*/
"extends": function() {
return this.scan(/^extends? +([^\n]+)/, 'extends');
},
/**
* Block prepend.
*/
prepend: function() {
var captures;
if (captures = /^prepend +([^\n]+)/.exec(this.input)) {
this.consume(captures[0].length);
var mode = 'prepend'
, name = captures[1]
, tok = this.tok('block', name);
tok.mode = mode;
return tok;
}
},
/**
* Block append.
*/
append: function() {
var captures;
if (captures = /^append +([^\n]+)/.exec(this.input)) {
this.consume(captures[0].length);
var mode = 'append'
, name = captures[1]
, tok = this.tok('block', name);
tok.mode = mode;
return tok;
}
},
/**
* Block.
*/
block: function() {
var captures;
if (captures = /^block\b *(?:(prepend|append) +)?([^\n]+)/.exec(this.input)) {
this.consume(captures[0].length);
var mode = captures[1] || 'replace'
, name = captures[2]
, tok = this.tok('block', name);
tok.mode = mode;
return tok;
}
},
/**
* Mixin Block.
*/
mixinBlock: function() {
var captures;
if (captures = /^block[ \t]*(\n|$)/.exec(this.input)) {
this.consume(captures[0].length - captures[1].length);
return this.tok('mixin-block');
}
},
/**
* Yield.
*/
'yield': function() {
return this.scan(/^yield */, 'yield');
},
/**
* Include.
*/
include: function() {
return this.scan(/^include +([^\n]+)/, 'include');
},
/**
* Include with filter
*/
includeFiltered: function() {
var captures;
if (captures = /^include:([\w\-]+)([\( ])/.exec(this.input)) {
this.consume(captures[0].length - 1);
var filter = captures[1];
var attrs = captures[2] === '(' ? this.attrs() : null;
if (!(captures[2] === ' ' || this.input[0] === ' ')) {
throw new Error('expected space after include:filter but got ' + utils.stringify(this.input[0]));
}
captures = /^ *([^\n]+)/.exec(this.input);
if (!captures || captures[1].trim() === '') {
throw new Error('missing path for include:filter');
}
this.consume(captures[0].length);
var path = captures[1];
var tok = this.tok('include', path);
tok.filter = filter;
tok.attrs = attrs;
return tok;
}
},
/**
* Case.
*/
"case": function() {
return this.scan(/^case +([^\n]+)/, 'case');
},
/**
* When.
*/
when: function() {
return this.scan(/^when +([^:\n]+)/, 'when');
},
/**
* Default.
*/
"default": function() {
return this.scan(/^default */, 'default');
},
/**
* Call mixin.
*/
call: function(){
var tok, captures;
if (captures = /^\+(\s*)(([-\w]+)|(#\{))/.exec(this.input)) {
// try to consume simple or interpolated call
if (captures[3]) {
// simple call
this.consume(captures[0].length);
tok = this.tok('call', captures[3]);
} else {
// interpolated call
var match = this.bracketExpression(2 + captures[1].length);
this.consume(match.end + 1);
assertExpression(match.src);
tok = this.tok('call', '#{'+match.src+'}');
}
// Check for args (not attributes)
if (captures = /^ *\(/.exec(this.input)) {
var range = this.bracketExpression(captures[0].length - 1);
if (!/^\s*[-\w]+ *=/.test(range.src)) { // not attributes
this.consume(range.end + 1);
tok.args = range.src;
}
if (tok.args) {
assertExpression('[' + tok.args + ']');
}
}
return tok;
}
},
/**
* Mixin.
*/
mixin: function(){
var captures;
if (captures = /^mixin +([-\w]+)(?: *\((.*)\))? */.exec(this.input)) {
this.consume(captures[0].length);
var tok = this.tok('mixin', captures[1]);
tok.args = captures[2];
return tok;
}
},
/**
* Conditional.
*/
conditional: function() {
var captures;
if (captures = /^(if|unless|else if|else)\b([^\n]*)/.exec(this.input)) {
this.consume(captures[0].length);
var type = captures[1]
var js = captures[2];
var isIf = false;
var isElse = false;
switch (type) {
case 'if':
assertExpression(js)
js = 'if (' + js + ')';
isIf = true;
break;
case 'unless':
assertExpression(js)
js = 'if (!(' + js + '))';
isIf = true;
break;
case 'else if':
assertExpression(js)
js = 'else if (' + js + ')';
isIf = true;
isElse = true;
break;
case 'else':
if (js && js.trim()) {
throw new Error('`else` cannot have a condition, perhaps you meant `else if`');
}
js = 'else';
isElse = true;
break;
}
var tok = this.tok('code', js);
tok.isElse = isElse;
tok.isIf = isIf;
tok.requiresBlock = true;
return tok;
}
},
/**
* While.
*/
"while": function() {
var captures;
if (captures = /^while +([^\n]+)/.exec(this.input)) {
this.consume(captures[0].length);
assertExpression(captures[1])
var tok = this.tok('code', 'while (' + captures[1] + ')');
tok.requiresBlock = true;
return tok;
}
},
/**
* Each.
*/
each: function() {
var captures;
if (captures = /^(?:- *)?(?:each|for) +([a-zA-Z_$][\w$]*)(?: *, *([a-zA-Z_$][\w$]*))? * in *([^\n]+)/.exec(this.input)) {
this.consume(captures[0].length);
var tok = this.tok('each', captures[1]);
tok.key = captures[2] || '$index';
assertExpression(captures[3])
tok.code = captures[3];
return tok;
}
},
/**
* Code.
*/
code: function() {
var captures;
if (captures = /^(!?=|-)[ \t]*([^\n]+)/.exec(this.input)) {
this.consume(captures[0].length);
var flags = captures[1];
captures[1] = captures[2];
var tok = this.tok('code', captures[1]);
tok.escape = flags.charAt(0) === '=';
tok.buffer = flags.charAt(0) === '=' || flags.charAt(1) === '=';
if (tok.buffer) assertExpression(captures[1])
return tok;
}
},
/**
* Block code.
*/
blockCode: function() {
var captures;
if (captures = /^-\n/.exec(this.input)) {
this.consume(captures[0].length - 1);
var tok = this.tok('blockCode');
this.pipeless = true;
return tok;
}
},
/**
* Attributes.
*/
attrs: function() {
if ('(' == this.input.charAt(0)) {
var index = this.bracketExpression().end
, str = this.input.substr(1, index-1)
, tok = this.tok('attrs');
assertNestingCorrect(str);
var quote = '';
var interpolate = function (attr) {
return attr.replace(/(\\)?#\{(.+)/g, function(_, escape, expr){
if (escape) return _;
try {
var range = characterParser.parseMax(expr);
if (expr[range.end] !== '}') return _.substr(0, 2) + interpolate(_.substr(2));
assertExpression(range.src)
return quote + " + (" + range.src + ") + " + quote + interpolate(expr.substr(range.end + 1));
} catch (ex) {
return _.substr(0, 2) + interpolate(_.substr(2));
}
});
}
this.consume(index + 1);
tok.attrs = [];
var escapedAttr = true
var key = '';
var val = '';
var interpolatable = '';
var state = characterParser.defaultState();
var loc = 'key';
var isEndOfAttribute = function (i) {
if (key.trim() === '') return false;
if (i === str.length) return true;
if (loc === 'key') {
if (str[i] === ' ' || str[i] === '\n') {
for (var x = i; x < str.length; x++) {
if (str[x] != ' ' && str[x] != '\n') {
if (str[x] === '=' || str[x] === '!' || str[x] === ',') return false;
else return true;
}
}
}
return str[i] === ','
} else if (loc === 'value' && !state.isNesting()) {
try {
assertExpression(val);
if (str[i] === ' ' || str[i] === '\n') {
for (var x = i; x < str.length; x++) {
if (str[x] != ' ' && str[x] != '\n') {
if (characterParser.isPunctuator(str[x]) && str[x] != '"' && str[x] != "'") return false;
else return true;
}
}
}
return str[i] === ',';
} catch (ex) {
return false;
}
}
}
this.lineno += str.split("\n").length - 1;
for (var i = 0; i <= str.length; i++) {
if (isEndOfAttribute(i)) {
val = val.trim();
if (val) assertExpression(val)
key = key.trim();
key = key.replace(/^['"]|['"]$/g, '');
tok.attrs.push({
name: key,
val: '' == val ? true : val,
escaped: escapedAttr
});
key = val = '';
loc = 'key';
escapedAttr = false;
} else {
switch (loc) {
case 'key-char':
if (str[i] === quote) {
loc = 'key';
if (i + 1 < str.length && [' ', ',', '!', '=', '\n'].indexOf(str[i + 1]) === -1)
throw new Error('Unexpected character ' + str[i + 1] + ' expected ` `, `\\n`, `,`, `!` or `=`');
} else {
key += str[i];
}
break;
case 'key':
if (key === '' && (str[i] === '"' || str[i] === "'")) {
loc = 'key-char';
quote = str[i];
} else if (str[i] === '!' || str[i] === '=') {
escapedAttr = str[i] !== '!';
if (str[i] === '!') i++;
if (str[i] !== '=') throw new Error('Unexpected character ' + str[i] + ' expected `=`');
loc = 'value';
state = characterParser.defaultState();
} else {
key += str[i]
}
break;
case 'value':
state = characterParser.parseChar(str[i], state);
if (state.isString()) {
loc = 'string';
quote = str[i];
interpolatable = str[i];
} else {
val += str[i];
}
break;
case 'string':
state = characterParser.parseChar(str[i], state);
interpolatable += str[i];
if (!state.isString()) {
loc = 'value';
val += interpolate(interpolatable);
}
break;
}
}
}
if ('/' == this.input.charAt(0)) {
this.consume(1);
tok.selfClosing = true;
}
return tok;
}
},
/**
* &attributes block
*/
attributesBlock: function () {
var captures;
if (/^&attributes\b/.test(this.input)) {
this.consume(11);
var args = this.bracketExpression();
this.consume(args.end + 1);
return this.tok('&attributes', args.src);
}
},
/**
* Indent | Outdent | Newline.
*/
indent: function() {
var captures, re;
// established regexp
if (this.indentRe) {
captures = this.indentRe.exec(this.input);
// determine regexp
} else {
// tabs
re = /^\n(\t*) */;
captures = re.exec(this.input);
// spaces
if (captures && !captures[1].length) {
re = /^\n( *)/;
captures = re.exec(this.input);
}
// established
if (captures && captures[1].length) this.indentRe = re;
}
if (captures) {
var tok
, indents = captures[1].length;
++this.lineno;
this.consume(indents + 1);
if (' ' == this.input[0] || '\t' == this.input[0]) {
throw new Error('Invalid indentation, you can use tabs or spaces but not both');
}
// blank line
if ('\n' == this.input[0]) {
this.pipeless = false;
return this.tok('newline');
}
// outdent
if (this.indentStack.length && indents < this.indentStack[0]) {
while (this.indentStack.length && this.indentStack[0] > indents) {
this.stash.push(this.tok('outdent'));
this.indentStack.shift();
}
tok = this.stash.pop();
// indent
} else if (indents && indents != this.indentStack[0]) {
this.indentStack.unshift(indents);
tok = this.tok('indent', indents);
// newline
} else {
tok = this.tok('newline');
}
this.pipeless = false;
return tok;
}
},
/**
* Pipe-less text consumed only when
* pipeless is true;
*/
pipelessText: function() {
if (!this.pipeless) return;
var captures, re;
// established regexp
if (this.indentRe) {
captures = this.indentRe.exec(this.input);
// determine regexp
} else {
// tabs
re = /^\n(\t*) */;
captures = re.exec(this.input);
// spaces
if (captures && !captures[1].length) {
re = /^\n( *)/;
captures = re.exec(this.input);
}
// established
if (captures && captures[1].length) this.indentRe = re;
}
var indents = captures && captures[1].length;
if (indents && (this.indentStack.length === 0 || indents > this.indentStack[0])) {
var indent = captures[1];
var line;
var tokens = [];
var isMatch;
do {
// text has `\n` as a prefix
var i = this.input.substr(1).indexOf('\n');
if (-1 == i) i = this.input.length - 1;
var str = this.input.substr(1, i);
isMatch = str.substr(0, indent.length) === indent || !str.trim();
if (isMatch) {
// consume test along with `\n` prefix if match
this.consume(str.length + 1);
++this.lineno;
tokens.push(str.substr(indent.length));
}
} while(this.input.length && isMatch);
while (this.input.length === 0 && tokens[tokens.length - 1] === '') tokens.pop();
return this.tok('pipeless-text', tokens);
}
},
/**
* ':'
*/
colon: function() {
var good = /^: +/.test(this.input);
var res = this.scan(/^: */, ':');
if (res && !good) {
console.warn('Warning: space required after `:` on line ' + this.lineno +
' of jade file "' + this.filename + '"');
}
return res;
},
fail: function () {
throw new Error('unexpected text ' + this.input.substr(0, 5));
},
/**
* Return the next token object, or those
* previously stashed by lookahead.
*
* @return {Object}
* @api private
*/
advance: function(){
return this.stashed()
|| this.next();
},
/**
* Return the next token object.
*
* @return {Object}
* @api private
*/
next: function() {
return this.deferred()
|| this.blank()
|| this.eos()
|| this.pipelessText()
|| this.yield()
|| this.doctype()
|| this.interpolation()
|| this["case"]()
|| this.when()
|| this["default"]()
|| this["extends"]()
|| this.append()
|| this.prepend()
|| this.block()
|| this.mixinBlock()
|| this.include()
|| this.includeFiltered()
|| this.mixin()
|| this.call()
|| this.conditional()
|| this.each()
|| this["while"]()
|| this.tag()
|| this.filter()
|| this.blockCode()
|| this.code()
|| this.id()
|| this.className()
|| this.attrs()
|| this.attributesBlock()
|| this.indent()
|| this.text()
|| this.comment()
|| this.colon()
|| this.dot()
|| this.textFail()
|| this.fail();
}
};

83
node_modules/jade/lib/nodes/attrs.js generated vendored Normal file
View File

@@ -0,0 +1,83 @@
'use strict';
var Node = require('./node');
/**
* Initialize a `Attrs` node.
*
* @api public
*/
var Attrs = module.exports = function Attrs() {
this.attributeNames = [];
this.attrs = [];
this.attributeBlocks = [];
};
// Inherit from `Node`.
Attrs.prototype = Object.create(Node.prototype);
Attrs.prototype.constructor = Attrs;
Attrs.prototype.type = 'Attrs';
/**
* Set attribute `name` to `val`, keep in mind these become
* part of a raw js object literal, so to quote a value you must
* '"quote me"', otherwise or example 'user.name' is literal JavaScript.
*
* @param {String} name
* @param {String} val
* @param {Boolean} escaped
* @return {Tag} for chaining
* @api public
*/
Attrs.prototype.setAttribute = function(name, val, escaped){
if (name !== 'class' && this.attributeNames.indexOf(name) !== -1) {
throw new Error('Duplicate attribute "' + name + '" is not allowed.');
}
this.attributeNames.push(name);
this.attrs.push({ name: name, val: val, escaped: escaped });
return this;
};
/**
* Remove attribute `name` when present.
*
* @param {String} name
* @api public
*/
Attrs.prototype.removeAttribute = function(name){
var err = new Error('attrs.removeAttribute is deprecated and will be removed in v2.0.0');
console.warn(err.stack);
for (var i = 0, len = this.attrs.length; i < len; ++i) {
if (this.attrs[i] && this.attrs[i].name == name) {
delete this.attrs[i];
}
}
};
/**
* Get attribute value by `name`.
*
* @param {String} name
* @return {String}
* @api public
*/
Attrs.prototype.getAttribute = function(name){
var err = new Error('attrs.getAttribute is deprecated and will be removed in v2.0.0');
console.warn(err.stack);
for (var i = 0, len = this.attrs.length; i < len; ++i) {
if (this.attrs[i] && this.attrs[i].name == name) {
return this.attrs[i].val;
}
}
};
Attrs.prototype.addAttributes = function (src) {
this.attributeBlocks.push(src);
};

24
node_modules/jade/lib/nodes/block-comment.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
'use strict';
var Node = require('./node');
/**
* Initialize a `BlockComment` with the given `block`.
*
* @param {String} val
* @param {Block} block
* @param {Boolean} buffer
* @api public
*/
var BlockComment = module.exports = function BlockComment(val, block, buffer) {
this.block = block;
this.val = val;
this.buffer = buffer;
};
// Inherit from `Node`.
BlockComment.prototype = Object.create(Node.prototype);
BlockComment.prototype.constructor = BlockComment;
BlockComment.prototype.type = 'BlockComment';

118
node_modules/jade/lib/nodes/block.js generated vendored Normal file
View File

@@ -0,0 +1,118 @@
'use strict';
var Node = require('./node');
/**
* Initialize a new `Block` with an optional `node`.
*
* @param {Node} node
* @api public
*/
var Block = module.exports = function Block(node){
this.nodes = [];
if (node) this.push(node);
};
// Inherit from `Node`.
Block.prototype = Object.create(Node.prototype);
Block.prototype.constructor = Block;
Block.prototype.type = 'Block';
/**
* Block flag.
*/
Block.prototype.isBlock = true;
/**
* Replace the nodes in `other` with the nodes
* in `this` block.
*
* @param {Block} other
* @api private
*/
Block.prototype.replace = function(other){
var err = new Error('block.replace is deprecated and will be removed in v2.0.0');
console.warn(err.stack);
other.nodes = this.nodes;
};
/**
* Push the given `node`.
*
* @param {Node} node
* @return {Number}
* @api public
*/
Block.prototype.push = function(node){
return this.nodes.push(node);
};
/**
* Check if this block is empty.
*
* @return {Boolean}
* @api public
*/
Block.prototype.isEmpty = function(){
return 0 == this.nodes.length;
};
/**
* Unshift the given `node`.
*
* @param {Node} node
* @return {Number}
* @api public
*/
Block.prototype.unshift = function(node){
return this.nodes.unshift(node);
};
/**
* Return the "last" block, or the first `yield` node.
*
* @return {Block}
* @api private
*/
Block.prototype.includeBlock = function(){
var ret = this
, node;
for (var i = 0, len = this.nodes.length; i < len; ++i) {
node = this.nodes[i];
if (node.yield) return node;
else if (node.textOnly) continue;
else if (node.includeBlock) ret = node.includeBlock();
else if (node.block && !node.block.isEmpty()) ret = node.block.includeBlock();
if (ret.yield) return ret;
}
return ret;
};
/**
* Return a clone of this block.
*
* @return {Block}
* @api private
*/
Block.prototype.clone = function(){
var err = new Error('block.clone is deprecated and will be removed in v2.0.0');
console.warn(err.stack);
var clone = new Block;
for (var i = 0, len = this.nodes.length; i < len; ++i) {
clone.push(this.nodes[i].clone());
}
return clone;
};

33
node_modules/jade/lib/nodes/case.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
'use strict';
var Node = require('./node');
/**
* Initialize a new `Case` with `expr`.
*
* @param {String} expr
* @api public
*/
var Case = exports = module.exports = function Case(expr, block){
this.expr = expr;
this.block = block;
};
// Inherit from `Node`.
Case.prototype = Object.create(Node.prototype);
Case.prototype.constructor = Case;
Case.prototype.type = 'Case';
var When = exports.When = function When(expr, block){
this.expr = expr;
this.block = block;
this.debug = false;
};
// Inherit from `Node`.
When.prototype = Object.create(Node.prototype);
When.prototype.constructor = When;
When.prototype.type = 'When';

26
node_modules/jade/lib/nodes/code.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
'use strict';
var Node = require('./node');
/**
* Initialize a `Code` node with the given code `val`.
* Code may also be optionally buffered and escaped.
*
* @param {String} val
* @param {Boolean} buffer
* @param {Boolean} escape
* @api public
*/
var Code = module.exports = function Code(val, buffer, escape) {
this.val = val;
this.buffer = buffer;
this.escape = escape;
if (val.match(/^ *else/)) this.debug = false;
};
// Inherit from `Node`.
Code.prototype = Object.create(Node.prototype);
Code.prototype.constructor = Code;
Code.prototype.type = 'Code'; // prevent the minifiers removing this

23
node_modules/jade/lib/nodes/comment.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
'use strict';
var Node = require('./node');
/**
* Initialize a `Comment` with the given `val`, optionally `buffer`,
* otherwise the comment may render in the output.
*
* @param {String} val
* @param {Boolean} buffer
* @api public
*/
var Comment = module.exports = function Comment(val, buffer) {
this.val = val;
this.buffer = buffer;
};
// Inherit from `Node`.
Comment.prototype = Object.create(Node.prototype);
Comment.prototype.constructor = Comment;
Comment.prototype.type = 'Comment';

20
node_modules/jade/lib/nodes/doctype.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
'use strict';
var Node = require('./node');
/**
* Initialize a `Doctype` with the given `val`.
*
* @param {String} val
* @api public
*/
var Doctype = module.exports = function Doctype(val) {
this.val = val;
};
// Inherit from `Node`.
Doctype.prototype = Object.create(Node.prototype);
Doctype.prototype.constructor = Doctype;
Doctype.prototype.type = 'Doctype';

26
node_modules/jade/lib/nodes/each.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
'use strict';
var Node = require('./node');
/**
* Initialize an `Each` node, representing iteration
*
* @param {String} obj
* @param {String} val
* @param {String} key
* @param {Block} block
* @api public
*/
var Each = module.exports = function Each(obj, val, key, block) {
this.obj = obj;
this.val = val;
this.key = key;
this.block = block;
};
// Inherit from `Node`.
Each.prototype = Object.create(Node.prototype);
Each.prototype.constructor = Each;
Each.prototype.type = 'Each';

24
node_modules/jade/lib/nodes/filter.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
'use strict';
var Node = require('./node');
/**
* Initialize a `Filter` node with the given
* filter `name` and `block`.
*
* @param {String} name
* @param {Block|Node} block
* @api public
*/
var Filter = module.exports = function Filter(name, block, attrs) {
this.name = name;
this.block = block;
this.attrs = attrs;
};
// Inherit from `Node`.
Filter.prototype = Object.create(Node.prototype);
Filter.prototype.constructor = Filter;
Filter.prototype.type = 'Filter';

16
node_modules/jade/lib/nodes/index.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
'use strict';
exports.Node = require('./node');
exports.Tag = require('./tag');
exports.Code = require('./code');
exports.Each = require('./each');
exports.Case = require('./case');
exports.Text = require('./text');
exports.Block = require('./block');
exports.MixinBlock = require('./mixin-block');
exports.Mixin = require('./mixin');
exports.Filter = require('./filter');
exports.Comment = require('./comment');
exports.Literal = require('./literal');
exports.BlockComment = require('./block-comment');
exports.Doctype = require('./doctype');

20
node_modules/jade/lib/nodes/literal.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
'use strict';
var Node = require('./node');
/**
* Initialize a `Literal` node with the given `str.
*
* @param {String} str
* @api public
*/
var Literal = module.exports = function Literal(str) {
this.str = str;
};
// Inherit from `Node`.
Literal.prototype = Object.create(Node.prototype);
Literal.prototype.constructor = Literal;
Literal.prototype.type = 'Literal';

18
node_modules/jade/lib/nodes/mixin-block.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
'use strict';
var Node = require('./node');
/**
* Initialize a new `Block` with an optional `node`.
*
* @param {Node} node
* @api public
*/
var MixinBlock = module.exports = function MixinBlock(){};
// Inherit from `Node`.
MixinBlock.prototype = Object.create(Node.prototype);
MixinBlock.prototype.constructor = MixinBlock;
MixinBlock.prototype.type = 'MixinBlock';

26
node_modules/jade/lib/nodes/mixin.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
'use strict';
var Attrs = require('./attrs');
/**
* Initialize a new `Mixin` with `name` and `block`.
*
* @param {String} name
* @param {String} args
* @param {Block} block
* @api public
*/
var Mixin = module.exports = function Mixin(name, args, block, call){
Attrs.call(this);
this.name = name;
this.args = args;
this.block = block;
this.call = call;
};
// Inherit from `Attrs`.
Mixin.prototype = Object.create(Attrs.prototype);
Mixin.prototype.constructor = Mixin;
Mixin.prototype.type = 'Mixin';

18
node_modules/jade/lib/nodes/node.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
'use strict';
var Node = module.exports = function Node(){};
/**
* Clone this node (return itself)
*
* @return {Node}
* @api private
*/
Node.prototype.clone = function(){
var err = new Error('node.clone is deprecated and will be removed in v2.0.0');
console.warn(err.stack);
return this;
};
Node.prototype.type = '';

89
node_modules/jade/lib/nodes/tag.js generated vendored Normal file
View File

@@ -0,0 +1,89 @@
'use strict';
var Attrs = require('./attrs');
var Block = require('./block');
var inlineTags = require('../inline-tags');
/**
* Initialize a `Tag` node with the given tag `name` and optional `block`.
*
* @param {String} name
* @param {Block} block
* @api public
*/
var Tag = module.exports = function Tag(name, block) {
Attrs.call(this);
this.name = name;
this.block = block || new Block;
};
// Inherit from `Attrs`.
Tag.prototype = Object.create(Attrs.prototype);
Tag.prototype.constructor = Tag;
Tag.prototype.type = 'Tag';
/**
* Clone this tag.
*
* @return {Tag}
* @api private
*/
Tag.prototype.clone = function(){
var err = new Error('tag.clone is deprecated and will be removed in v2.0.0');
console.warn(err.stack);
var clone = new Tag(this.name, this.block.clone());
clone.line = this.line;
clone.attrs = this.attrs;
clone.textOnly = this.textOnly;
return clone;
};
/**
* Check if this tag is an inline tag.
*
* @return {Boolean}
* @api private
*/
Tag.prototype.isInline = function(){
return ~inlineTags.indexOf(this.name);
};
/**
* Check if this tag's contents can be inlined. Used for pretty printing.
*
* @return {Boolean}
* @api private
*/
Tag.prototype.canInline = function(){
var nodes = this.block.nodes;
function isInline(node){
// Recurse if the node is a block
if (node.isBlock) return node.nodes.every(isInline);
return node.isText || (node.isInline && node.isInline());
}
// Empty tag
if (!nodes.length) return true;
// Text-only or inline-only tag
if (1 == nodes.length) return isInline(nodes[0]);
// Multi-line inline-only tag
if (this.block.nodes.every(isInline)) {
for (var i = 1, len = nodes.length; i < len; ++i) {
if (nodes[i-1].isText && nodes[i].isText)
return false;
}
return true;
}
// Mixed tag
return false;
};

26
node_modules/jade/lib/nodes/text.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
'use strict';
var Node = require('./node');
/**
* Initialize a `Text` node with optional `line`.
*
* @param {String} line
* @api public
*/
var Text = module.exports = function Text(line) {
this.val = line;
};
// Inherit from `Node`.
Text.prototype = Object.create(Node.prototype);
Text.prototype.constructor = Text;
Text.prototype.type = 'Text';
/**
* Flag as text.
*/
Text.prototype.isText = true;

846
node_modules/jade/lib/parser.js generated vendored Normal file
View File

@@ -0,0 +1,846 @@
'use strict';
var Lexer = require('./lexer');
var nodes = require('./nodes');
var utils = require('./utils');
var filters = require('./filters');
var path = require('path');
var constantinople = require('constantinople');
var parseJSExpression = require('character-parser').parseMax;
var extname = path.extname;
/**
* Initialize `Parser` with the given input `str` and `filename`.
*
* @param {String} str
* @param {String} filename
* @param {Object} options
* @api public
*/
var Parser = exports = module.exports = function Parser(str, filename, options){
//Strip any UTF-8 BOM off of the start of `str`, if it exists.
this.input = str.replace(/^\uFEFF/, '');
this.lexer = new Lexer(this.input, filename);
this.filename = filename;
this.blocks = {};
this.mixins = {};
this.options = options;
this.contexts = [this];
this.inMixin = 0;
this.dependencies = [];
this.inBlock = 0;
};
/**
* Parser prototype.
*/
Parser.prototype = {
/**
* Save original constructor
*/
constructor: Parser,
/**
* Push `parser` onto the context stack,
* or pop and return a `Parser`.
*/
context: function(parser){
if (parser) {
this.contexts.push(parser);
} else {
return this.contexts.pop();
}
},
/**
* Return the next token object.
*
* @return {Object}
* @api private
*/
advance: function(){
return this.lexer.advance();
},
/**
* Single token lookahead.
*
* @return {Object}
* @api private
*/
peek: function() {
return this.lookahead(1);
},
/**
* Return lexer lineno.
*
* @return {Number}
* @api private
*/
line: function() {
return this.lexer.lineno;
},
/**
* `n` token lookahead.
*
* @param {Number} n
* @return {Object}
* @api private
*/
lookahead: function(n){
return this.lexer.lookahead(n);
},
/**
* Parse input returning a string of js for evaluation.
*
* @return {String}
* @api public
*/
parse: function(){
var block = new nodes.Block, parser;
block.line = 0;
block.filename = this.filename;
while ('eos' != this.peek().type) {
if ('newline' == this.peek().type) {
this.advance();
} else {
var next = this.peek();
var expr = this.parseExpr();
expr.filename = expr.filename || this.filename;
expr.line = next.line;
block.push(expr);
}
}
if (parser = this.extending) {
this.context(parser);
var ast = parser.parse();
this.context();
// hoist mixins
for (var name in this.mixins)
ast.unshift(this.mixins[name]);
return ast;
}
if (!this.extending && !this.included && Object.keys(this.blocks).length){
var blocks = [];
utils.walkAST(block, function (node) {
if (node.type === 'Block' && node.name) {
blocks.push(node.name);
}
});
Object.keys(this.blocks).forEach(function (name) {
if (blocks.indexOf(name) === -1 && !this.blocks[name].isSubBlock) {
console.warn('Warning: Unexpected block "'
+ name
+ '" '
+ ' on line '
+ this.blocks[name].line
+ ' of '
+ (this.blocks[name].filename)
+ '. This block is never used. This warning will be an error in v2.0.0');
}
}.bind(this));
}
return block;
},
/**
* Expect the given type, or throw an exception.
*
* @param {String} type
* @api private
*/
expect: function(type){
if (this.peek().type === type) {
return this.advance();
} else {
throw new Error('expected "' + type + '", but got "' + this.peek().type + '"');
}
},
/**
* Accept the given `type`.
*
* @param {String} type
* @api private
*/
accept: function(type){
if (this.peek().type === type) {
return this.advance();
}
},
/**
* tag
* | doctype
* | mixin
* | include
* | filter
* | comment
* | text
* | each
* | code
* | yield
* | id
* | class
* | interpolation
*/
parseExpr: function(){
switch (this.peek().type) {
case 'tag':
return this.parseTag();
case 'mixin':
return this.parseMixin();
case 'block':
return this.parseBlock();
case 'mixin-block':
return this.parseMixinBlock();
case 'case':
return this.parseCase();
case 'extends':
return this.parseExtends();
case 'include':
return this.parseInclude();
case 'doctype':
return this.parseDoctype();
case 'filter':
return this.parseFilter();
case 'comment':
return this.parseComment();
case 'text':
return this.parseText();
case 'each':
return this.parseEach();
case 'code':
return this.parseCode();
case 'blockCode':
return this.parseBlockCode();
case 'call':
return this.parseCall();
case 'interpolation':
return this.parseInterpolation();
case 'yield':
this.advance();
var block = new nodes.Block;
block.yield = true;
return block;
case 'id':
case 'class':
var tok = this.advance();
this.lexer.defer(this.lexer.tok('tag', 'div'));
this.lexer.defer(tok);
return this.parseExpr();
default:
throw new Error('unexpected token "' + this.peek().type + '"');
}
},
/**
* Text
*/
parseText: function(){
var tok = this.expect('text');
var tokens = this.parseInlineTagsInText(tok.val);
if (tokens.length === 1) return tokens[0];
var node = new nodes.Block;
for (var i = 0; i < tokens.length; i++) {
node.push(tokens[i]);
};
return node;
},
/**
* ':' expr
* | block
*/
parseBlockExpansion: function(){
if (':' == this.peek().type) {
this.advance();
return new nodes.Block(this.parseExpr());
} else {
return this.block();
}
},
/**
* case
*/
parseCase: function(){
var val = this.expect('case').val;
var node = new nodes.Case(val);
node.line = this.line();
var block = new nodes.Block;
block.line = this.line();
block.filename = this.filename;
this.expect('indent');
while ('outdent' != this.peek().type) {
switch (this.peek().type) {
case 'comment':
case 'newline':
this.advance();
break;
case 'when':
block.push(this.parseWhen());
break;
case 'default':
block.push(this.parseDefault());
break;
default:
throw new Error('Unexpected token "' + this.peek().type
+ '", expected "when", "default" or "newline"');
}
}
this.expect('outdent');
node.block = block;
return node;
},
/**
* when
*/
parseWhen: function(){
var val = this.expect('when').val;
if (this.peek().type !== 'newline')
return new nodes.Case.When(val, this.parseBlockExpansion());
else
return new nodes.Case.When(val);
},
/**
* default
*/
parseDefault: function(){
this.expect('default');
return new nodes.Case.When('default', this.parseBlockExpansion());
},
/**
* code
*/
parseCode: function(afterIf){
var tok = this.expect('code');
var node = new nodes.Code(tok.val, tok.buffer, tok.escape);
var block;
node.line = this.line();
// throw an error if an else does not have an if
if (tok.isElse && !tok.hasIf) {
throw new Error('Unexpected else without if');
}
// handle block
block = 'indent' == this.peek().type;
if (block) {
node.block = this.block();
}
// handle missing block
if (tok.requiresBlock && !block) {
node.block = new nodes.Block();
}
// mark presense of if for future elses
if (tok.isIf && this.peek().isElse) {
this.peek().hasIf = true;
} else if (tok.isIf && this.peek().type === 'newline' && this.lookahead(2).isElse) {
this.lookahead(2).hasIf = true;
}
return node;
},
/**
* block code
*/
parseBlockCode: function(){
var tok = this.expect('blockCode');
var node;
var body = this.peek();
var text;
if (body.type === 'pipeless-text') {
this.advance();
text = body.val.join('\n');
} else {
text = '';
}
node = new nodes.Code(text, false, false);
return node;
},
/**
* comment
*/
parseComment: function(){
var tok = this.expect('comment');
var node;
var block;
if (block = this.parseTextBlock()) {
node = new nodes.BlockComment(tok.val, block, tok.buffer);
} else {
node = new nodes.Comment(tok.val, tok.buffer);
}
node.line = this.line();
return node;
},
/**
* doctype
*/
parseDoctype: function(){
var tok = this.expect('doctype');
var node = new nodes.Doctype(tok.val);
node.line = this.line();
return node;
},
/**
* filter attrs? text-block
*/
parseFilter: function(){
var tok = this.expect('filter');
var attrs = this.accept('attrs');
var block;
block = this.parseTextBlock() || new nodes.Block();
var options = {};
if (attrs) {
attrs.attrs.forEach(function (attribute) {
options[attribute.name] = constantinople.toConstant(attribute.val);
});
}
var node = new nodes.Filter(tok.val, block, options);
node.line = this.line();
return node;
},
/**
* each block
*/
parseEach: function(){
var tok = this.expect('each');
var node = new nodes.Each(tok.code, tok.val, tok.key);
node.line = this.line();
node.block = this.block();
if (this.peek().type == 'code' && this.peek().val == 'else') {
this.advance();
node.alternative = this.block();
}
return node;
},
/**
* Resolves a path relative to the template for use in
* includes and extends
*
* @param {String} path
* @param {String} purpose Used in error messages.
* @return {String}
* @api private
*/
resolvePath: function (path, purpose) {
var p = require('path');
var dirname = p.dirname;
var basename = p.basename;
var join = p.join;
if (path[0] !== '/' && !this.filename)
throw new Error('the "filename" option is required to use "' + purpose + '" with "relative" paths');
if (path[0] === '/' && !this.options.basedir)
throw new Error('the "basedir" option is required to use "' + purpose + '" with "absolute" paths');
path = join(path[0] === '/' ? this.options.basedir : dirname(this.filename), path);
if (basename(path).indexOf('.') === -1) path += '.jade';
return path;
},
/**
* 'extends' name
*/
parseExtends: function(){
var fs = require('fs');
var path = this.resolvePath(this.expect('extends').val.trim(), 'extends');
if ('.jade' != path.substr(-5)) path += '.jade';
this.dependencies.push(path);
var str = fs.readFileSync(path, 'utf8');
var parser = new this.constructor(str, path, this.options);
parser.dependencies = this.dependencies;
parser.blocks = this.blocks;
parser.included = this.included;
parser.contexts = this.contexts;
this.extending = parser;
// TODO: null node
return new nodes.Literal('');
},
/**
* 'block' name block
*/
parseBlock: function(){
var block = this.expect('block');
var mode = block.mode;
var name = block.val.trim();
var line = block.line;
this.inBlock++;
block = 'indent' == this.peek().type
? this.block()
: new nodes.Block(new nodes.Literal(''));
this.inBlock--;
block.name = name;
block.line = line;
var prev = this.blocks[name] || {prepended: [], appended: []}
if (prev.mode === 'replace') return this.blocks[name] = prev;
var allNodes = prev.prepended.concat(block.nodes).concat(prev.appended);
switch (mode) {
case 'append':
prev.appended = prev.parser === this ?
prev.appended.concat(block.nodes) :
block.nodes.concat(prev.appended);
break;
case 'prepend':
prev.prepended = prev.parser === this ?
block.nodes.concat(prev.prepended) :
prev.prepended.concat(block.nodes);
break;
}
block.nodes = allNodes;
block.appended = prev.appended;
block.prepended = prev.prepended;
block.mode = mode;
block.parser = this;
block.isSubBlock = this.inBlock > 0;
return this.blocks[name] = block;
},
parseMixinBlock: function () {
var block = this.expect('mixin-block');
if (!this.inMixin) {
throw new Error('Anonymous blocks are not allowed unless they are part of a mixin.');
}
return new nodes.MixinBlock();
},
/**
* include block?
*/
parseInclude: function(){
var fs = require('fs');
var tok = this.expect('include');
var path = this.resolvePath(tok.val.trim(), 'include');
this.dependencies.push(path);
// has-filter
if (tok.filter) {
var str = fs.readFileSync(path, 'utf8').replace(/\r/g, '');
var options = {filename: path};
if (tok.attrs) {
tok.attrs.attrs.forEach(function (attribute) {
options[attribute.name] = constantinople.toConstant(attribute.val);
});
}
str = filters(tok.filter, str, options);
return new nodes.Literal(str);
}
// non-jade
if ('.jade' != path.substr(-5)) {
var str = fs.readFileSync(path, 'utf8').replace(/\r/g, '');
return new nodes.Literal(str);
}
var str = fs.readFileSync(path, 'utf8');
var parser = new this.constructor(str, path, this.options);
parser.dependencies = this.dependencies;
parser.blocks = utils.merge({}, this.blocks);
parser.included = true;
parser.mixins = this.mixins;
this.context(parser);
var ast = parser.parse();
this.context();
ast.filename = path;
if ('indent' == this.peek().type) {
ast.includeBlock().push(this.block());
}
return ast;
},
/**
* call ident block
*/
parseCall: function(){
var tok = this.expect('call');
var name = tok.val;
var args = tok.args;
var mixin = new nodes.Mixin(name, args, new nodes.Block, true);
this.tag(mixin);
if (mixin.code) {
mixin.block.push(mixin.code);
mixin.code = null;
}
if (mixin.block.isEmpty()) mixin.block = null;
return mixin;
},
/**
* mixin block
*/
parseMixin: function(){
var tok = this.expect('mixin');
var name = tok.val;
var args = tok.args;
var mixin;
// definition
if ('indent' == this.peek().type) {
this.inMixin++;
mixin = new nodes.Mixin(name, args, this.block(), false);
this.mixins[name] = mixin;
this.inMixin--;
return mixin;
// call
} else {
return new nodes.Mixin(name, args, null, true);
}
},
parseInlineTagsInText: function (str) {
var line = this.line();
var match = /(\\)?#\[((?:.|\n)*)$/.exec(str);
if (match) {
if (match[1]) { // escape
var text = new nodes.Text(str.substr(0, match.index) + '#[');
text.line = line;
var rest = this.parseInlineTagsInText(match[2]);
if (rest[0].type === 'Text') {
text.val += rest[0].val;
rest.shift();
}
return [text].concat(rest);
} else {
var text = new nodes.Text(str.substr(0, match.index));
text.line = line;
var buffer = [text];
var rest = match[2];
var range = parseJSExpression(rest);
var inner = new Parser(range.src, this.filename, this.options);
buffer.push(inner.parse());
return buffer.concat(this.parseInlineTagsInText(rest.substr(range.end + 1)));
}
} else {
var text = new nodes.Text(str);
text.line = line;
return [text];
}
},
/**
* indent (text | newline)* outdent
*/
parseTextBlock: function(){
var block = new nodes.Block;
block.line = this.line();
var body = this.peek();
if (body.type !== 'pipeless-text') return;
this.advance();
block.nodes = body.val.reduce(function (accumulator, text) {
return accumulator.concat(this.parseInlineTagsInText(text));
}.bind(this), []);
return block;
},
/**
* indent expr* outdent
*/
block: function(){
var block = new nodes.Block;
block.line = this.line();
block.filename = this.filename;
this.expect('indent');
while ('outdent' != this.peek().type) {
if ('newline' == this.peek().type) {
this.advance();
} else {
var expr = this.parseExpr();
expr.filename = this.filename;
block.push(expr);
}
}
this.expect('outdent');
return block;
},
/**
* interpolation (attrs | class | id)* (text | code | ':')? newline* block?
*/
parseInterpolation: function(){
var tok = this.advance();
var tag = new nodes.Tag(tok.val);
tag.buffer = true;
return this.tag(tag);
},
/**
* tag (attrs | class | id)* (text | code | ':')? newline* block?
*/
parseTag: function(){
var tok = this.advance();
var tag = new nodes.Tag(tok.val);
tag.selfClosing = tok.selfClosing;
return this.tag(tag);
},
/**
* Parse tag.
*/
tag: function(tag){
tag.line = this.line();
var seenAttrs = false;
// (attrs | class | id)*
out:
while (true) {
switch (this.peek().type) {
case 'id':
case 'class':
var tok = this.advance();
tag.setAttribute(tok.type, "'" + tok.val + "'");
continue;
case 'attrs':
if (seenAttrs) {
console.warn(this.filename + ', line ' + this.peek().line + ':\nYou should not have jade tags with multiple attributes.');
}
seenAttrs = true;
var tok = this.advance();
var attrs = tok.attrs;
if (tok.selfClosing) tag.selfClosing = true;
for (var i = 0; i < attrs.length; i++) {
tag.setAttribute(attrs[i].name, attrs[i].val, attrs[i].escaped);
}
continue;
case '&attributes':
var tok = this.advance();
tag.addAttributes(tok.val);
break;
default:
break out;
}
}
// check immediate '.'
if ('dot' == this.peek().type) {
tag.textOnly = true;
this.advance();
}
// (text | code | ':')?
switch (this.peek().type) {
case 'text':
tag.block.push(this.parseText());
break;
case 'code':
tag.code = this.parseCode();
break;
case ':':
this.advance();
tag.block = new nodes.Block;
tag.block.push(this.parseExpr());
break;
case 'newline':
case 'indent':
case 'outdent':
case 'eos':
case 'pipeless-text':
break;
default:
throw new Error('Unexpected token `' + this.peek().type + '` expected `text`, `code`, `:`, `newline` or `eos`')
}
// newline*
while ('newline' == this.peek().type) this.advance();
// block?
if (tag.textOnly) {
tag.block = this.parseTextBlock() || new nodes.Block();
} else if ('indent' == this.peek().type) {
var block = this.block();
for (var i = 0, len = block.nodes.length; i < len; ++i) {
tag.block.push(block.nodes[i]);
}
}
return tag;
}
};

246
node_modules/jade/lib/runtime.js generated vendored Normal file
View File

@@ -0,0 +1,246 @@
'use strict';
/**
* Merge two attribute objects giving precedence
* to values in object `b`. Classes are special-cased
* allowing for arrays and merging/joining appropriately
* resulting in a string.
*
* @param {Object} a
* @param {Object} b
* @return {Object} a
* @api private
*/
exports.merge = function merge(a, b) {
if (arguments.length === 1) {
var attrs = a[0];
for (var i = 1; i < a.length; i++) {
attrs = merge(attrs, a[i]);
}
return attrs;
}
var ac = a['class'];
var bc = b['class'];
if (ac || bc) {
ac = ac || [];
bc = bc || [];
if (!Array.isArray(ac)) ac = [ac];
if (!Array.isArray(bc)) bc = [bc];
a['class'] = ac.concat(bc).filter(nulls);
}
for (var key in b) {
if (key != 'class') {
a[key] = b[key];
}
}
return a;
};
/**
* Filter null `val`s.
*
* @param {*} val
* @return {Boolean}
* @api private
*/
function nulls(val) {
return val != null && val !== '';
}
/**
* join array as classes.
*
* @param {*} val
* @return {String}
*/
exports.joinClasses = joinClasses;
function joinClasses(val) {
return (Array.isArray(val) ? val.map(joinClasses) :
(val && typeof val === 'object') ? Object.keys(val).filter(function (key) { return val[key]; }) :
[val]).filter(nulls).join(' ');
}
/**
* Render the given classes.
*
* @param {Array} classes
* @param {Array.<Boolean>} escaped
* @return {String}
*/
exports.cls = function cls(classes, escaped) {
var buf = [];
for (var i = 0; i < classes.length; i++) {
if (escaped && escaped[i]) {
buf.push(exports.escape(joinClasses([classes[i]])));
} else {
buf.push(joinClasses(classes[i]));
}
}
var text = joinClasses(buf);
if (text.length) {
return ' class="' + text + '"';
} else {
return '';
}
};
exports.style = function (val) {
if (val && typeof val === 'object') {
return Object.keys(val).map(function (style) {
return style + ':' + val[style];
}).join(';');
} else {
return val;
}
};
/**
* Render the given attribute.
*
* @param {String} key
* @param {String} val
* @param {Boolean} escaped
* @param {Boolean} terse
* @return {String}
*/
exports.attr = function attr(key, val, escaped, terse) {
if (key === 'style') {
val = exports.style(val);
}
if ('boolean' == typeof val || null == val) {
if (val) {
return ' ' + (terse ? key : key + '="' + key + '"');
} else {
return '';
}
} else if (0 == key.indexOf('data') && 'string' != typeof val) {
if (JSON.stringify(val).indexOf('&') !== -1) {
console.warn('Since Jade 2.0.0, ampersands (`&`) in data attributes ' +
'will be escaped to `&amp;`');
};
if (val && typeof val.toISOString === 'function') {
console.warn('Jade will eliminate the double quotes around dates in ' +
'ISO form after 2.0.0');
}
return ' ' + key + "='" + JSON.stringify(val).replace(/'/g, '&apos;') + "'";
} else if (escaped) {
if (val && typeof val.toISOString === 'function') {
console.warn('Jade will stringify dates in ISO form after 2.0.0');
}
return ' ' + key + '="' + exports.escape(val) + '"';
} else {
if (val && typeof val.toISOString === 'function') {
console.warn('Jade will stringify dates in ISO form after 2.0.0');
}
return ' ' + key + '="' + val + '"';
}
};
/**
* Render the given attributes object.
*
* @param {Object} obj
* @param {Object} escaped
* @return {String}
*/
exports.attrs = function attrs(obj, terse){
var buf = [];
var keys = Object.keys(obj);
if (keys.length) {
for (var i = 0; i < keys.length; ++i) {
var key = keys[i]
, val = obj[key];
if ('class' == key) {
if (val = joinClasses(val)) {
buf.push(' ' + key + '="' + val + '"');
}
} else {
buf.push(exports.attr(key, val, false, terse));
}
}
}
return buf.join('');
};
/**
* Escape the given string of `html`.
*
* @param {String} html
* @return {String}
* @api private
*/
var jade_encode_html_rules = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;'
};
var jade_match_html = /[&<>"]/g;
function jade_encode_char(c) {
return jade_encode_html_rules[c] || c;
}
exports.escape = jade_escape;
function jade_escape(html){
var result = String(html).replace(jade_match_html, jade_encode_char);
if (result === '' + html) return html;
else return result;
};
/**
* Re-throw the given `err` in context to the
* the jade in `filename` at the given `lineno`.
*
* @param {Error} err
* @param {String} filename
* @param {String} lineno
* @api private
*/
exports.rethrow = function rethrow(err, filename, lineno, str){
if (!(err instanceof Error)) throw err;
if ((typeof window != 'undefined' || !filename) && !str) {
err.message += ' on line ' + lineno;
throw err;
}
try {
str = str || require('fs').readFileSync(filename, 'utf8')
} catch (ex) {
rethrow(err, null, lineno)
}
var context = 3
, lines = str.split('\n')
, start = Math.max(lineno - context, 0)
, end = Math.min(lines.length, lineno + context);
// Error context
var context = lines.slice(start, end).map(function(line, i){
var curr = i + start + 1;
return (curr == lineno ? ' > ' : ' ')
+ curr
+ '| '
+ line;
}).join('\n');
// Alter exception message
err.path = filename;
err.message = (filename || 'Jade') + ':' + lineno
+ '\n' + context + '\n\n' + err.message;
throw err;
};
exports.DebugItem = function DebugItem(lineno, filename) {
this.lineno = lineno;
this.filename = filename;
}

53
node_modules/jade/lib/utils.js generated vendored Normal file
View File

@@ -0,0 +1,53 @@
'use strict';
/**
* Merge `b` into `a`.
*
* @param {Object} a
* @param {Object} b
* @return {Object}
* @api public
*/
exports.merge = function(a, b) {
for (var key in b) a[key] = b[key];
return a;
};
exports.stringify = function(str) {
return JSON.stringify(str)
.replace(/\u2028/g, '\\u2028')
.replace(/\u2029/g, '\\u2029');
};
exports.walkAST = function walkAST(ast, before, after) {
before && before(ast);
switch (ast.type) {
case 'Block':
ast.nodes.forEach(function (node) {
walkAST(node, before, after);
});
break;
case 'Case':
case 'Each':
case 'Mixin':
case 'Tag':
case 'When':
case 'Code':
ast.block && walkAST(ast.block, before, after);
break;
case 'Attrs':
case 'BlockComment':
case 'Comment':
case 'Doctype':
case 'Filter':
case 'Literal':
case 'MixinBlock':
case 'Text':
break;
default:
throw new Error('Unexpected node type ' + ast.type);
break;
}
after && after(ast);
};

150
node_modules/jade/package.json generated vendored Normal file
View File

@@ -0,0 +1,150 @@
{
"_args": [
[
"jade",
"C:\\Users\\IT-134\\Desktop\\PortableGit\\repos\\html5-restaurant"
]
],
"_from": "jade@latest",
"_id": "jade@1.11.0",
"_inCache": true,
"_installable": true,
"_location": "/jade",
"_nodeVersion": "2.2.1",
"_npmUser": {
"email": "npm@lubbe.org",
"name": "alubbe"
},
"_npmVersion": "2.11.0",
"_phantomChildren": {},
"_requested": {
"name": "jade",
"raw": "jade",
"rawSpec": "",
"scope": null,
"spec": "latest",
"type": "tag"
},
"_requiredBy": [
"#USER"
],
"_resolved": "https://registry.npmjs.org/jade/-/jade-1.11.0.tgz",
"_shasum": "9c80e538c12d3fb95c8d9bb9559fa0cc040405fd",
"_shrinkwrap": null,
"_spec": "jade",
"_where": "C:\\Users\\IT-134\\Desktop\\PortableGit\\repos\\html5-restaurant",
"author": {
"email": "tj@vision-media.ca",
"name": "TJ Holowaychuk"
},
"bin": {
"jade": "./bin/jade.js"
},
"browser": {
"./lib/filters.js": "./lib/filters-client.js",
"fs": false
},
"bugs": {
"url": "https://github.com/jadejs/jade/issues"
},
"component": {
"scripts": {
"jade": "runtime.js"
}
},
"dependencies": {
"character-parser": "1.2.1",
"clean-css": "^3.1.9",
"commander": "~2.6.0",
"constantinople": "~3.0.1",
"jstransformer": "0.0.2",
"mkdirp": "~0.5.0",
"transformers": "2.1.0",
"uglify-js": "^2.4.19",
"void-elements": "~2.0.1",
"with": "~4.0.0"
},
"description": "A clean, whitespace-sensitive template language for writing HTML",
"devDependencies": {
"browserify": "*",
"browserify-middleware": "~4.1.0",
"code-mirror": "~3.22.0",
"coffee-script": "*",
"coveralls": "^2.11.2",
"express": "~4.10.4",
"github-basic": "^4.1.2",
"handle": "~1.0.0",
"highlight-codemirror": "~4.1.0",
"inconsolata": "0.0.2",
"istanbul": "*",
"jade-code-mirror": "~1.0.5",
"jade-highlighter": "~1.0.5",
"jstransformer-cdata": "0.0.3",
"jstransformer-coffee-script": "0.0.2",
"jstransformer-less": "^1.0.0",
"jstransformer-marked": "0.0.1",
"jstransformer-stylus": "0.0.1",
"jstransformer-verbatim": "0.0.2",
"less": "<2.0.0",
"less-file": "0.0.9",
"linify": "*",
"lsr": "^1.0.0",
"marked": "~0.3.3",
"mocha": "*",
"opener": "^1.3.0",
"pull-request": "^3.0.0",
"rimraf": "^2.2.8",
"should": "*",
"stop": "^3.0.0-rc1",
"stylus": "*",
"twbs": "0.0.6",
"uglify-js": "*"
},
"directories": {},
"dist": {
"shasum": "9c80e538c12d3fb95c8d9bb9559fa0cc040405fd",
"tarball": "http://registry.npmjs.org/jade/-/jade-1.11.0.tgz"
},
"gitHead": "31966399f86b15159f2ff47dff99fbf4c92fadd5",
"homepage": "http://jade-lang.com",
"license": "MIT",
"main": "lib",
"maintainers": [
{
"name": "forbeslindesay",
"email": "forbes@lindesay.co.uk"
},
{
"name": "bloodyowl",
"email": "mlbli@me.com"
},
{
"name": "jbnicolai",
"email": "jappelman@xebia.com"
},
{
"name": "alubbe",
"email": "npm@lubbe.org"
}
],
"name": "jade",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/jadejs/jade.git"
},
"scripts": {
"build": "npm run compile",
"compile": "npm run compile-full && npm run compile-runtime",
"compile-full": "browserify ./lib/index.js --standalone jade -x ./node_modules/transformers > jade.js",
"compile-runtime": "browserify ./lib/runtime.js --standalone jade > runtime.js",
"coverage": "istanbul cover --report none --dir cov-pt0 node_modules/mocha/bin/_mocha -- -R dot",
"coveralls": "npm run coverage && cat ./coverage/lcov.info | coveralls",
"postcoverage": "istanbul report --include cov-pt\\*/coverage.json && rimraf cov-pt*",
"precoverage": "rimraf coverage && rimraf cov-pt*",
"prepublish": "npm prune && linify transform bin && npm run build",
"test": "mocha -R spec"
},
"version": "1.11.0"
}

35
node_modules/jade/release.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
'use strict';
var fs = require('fs');
var pr = require('pull-request');
var readdirp = require('lsr').sync;
var TOKEN = JSON.parse(fs.readFileSync(__dirname + '/.release.json', 'utf8'));
// todo: check that the version is a new un-released version
// todo: check the user has commit access to the github repo
// todo: check the user is an owner in npm
// todo: check History.md has been updated
var version = require('./package.json').version;
var compiledWebsite = require('./docs/stop.js');
compiledWebsite.then(function () {
var fileUpdates = readdirp(__dirname + '/docs/out').filter(function (info) {
return info.isFile();
}).map(function (info) {
return {
path: info.path.replace(/^\.\//, ''),
content: fs.readFileSync(info.fullPath)
};
});
return pr.commit('jadejs', 'jade', {
branch: 'gh-pages',
message: 'Update website for ' + version,
updates: fileUpdates
}, {auth: {type: 'oauth', token: TOKEN}});
}).then(function () {
// todo: release the new npm package, set the tag and commit etc.
}).done(function () {
console.log('website published');
});

252
node_modules/jade/runtime.js generated vendored Normal file
View File

@@ -0,0 +1,252 @@
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jade = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';
/**
* Merge two attribute objects giving precedence
* to values in object `b`. Classes are special-cased
* allowing for arrays and merging/joining appropriately
* resulting in a string.
*
* @param {Object} a
* @param {Object} b
* @return {Object} a
* @api private
*/
exports.merge = function merge(a, b) {
if (arguments.length === 1) {
var attrs = a[0];
for (var i = 1; i < a.length; i++) {
attrs = merge(attrs, a[i]);
}
return attrs;
}
var ac = a['class'];
var bc = b['class'];
if (ac || bc) {
ac = ac || [];
bc = bc || [];
if (!Array.isArray(ac)) ac = [ac];
if (!Array.isArray(bc)) bc = [bc];
a['class'] = ac.concat(bc).filter(nulls);
}
for (var key in b) {
if (key != 'class') {
a[key] = b[key];
}
}
return a;
};
/**
* Filter null `val`s.
*
* @param {*} val
* @return {Boolean}
* @api private
*/
function nulls(val) {
return val != null && val !== '';
}
/**
* join array as classes.
*
* @param {*} val
* @return {String}
*/
exports.joinClasses = joinClasses;
function joinClasses(val) {
return (Array.isArray(val) ? val.map(joinClasses) :
(val && typeof val === 'object') ? Object.keys(val).filter(function (key) { return val[key]; }) :
[val]).filter(nulls).join(' ');
}
/**
* Render the given classes.
*
* @param {Array} classes
* @param {Array.<Boolean>} escaped
* @return {String}
*/
exports.cls = function cls(classes, escaped) {
var buf = [];
for (var i = 0; i < classes.length; i++) {
if (escaped && escaped[i]) {
buf.push(exports.escape(joinClasses([classes[i]])));
} else {
buf.push(joinClasses(classes[i]));
}
}
var text = joinClasses(buf);
if (text.length) {
return ' class="' + text + '"';
} else {
return '';
}
};
exports.style = function (val) {
if (val && typeof val === 'object') {
return Object.keys(val).map(function (style) {
return style + ':' + val[style];
}).join(';');
} else {
return val;
}
};
/**
* Render the given attribute.
*
* @param {String} key
* @param {String} val
* @param {Boolean} escaped
* @param {Boolean} terse
* @return {String}
*/
exports.attr = function attr(key, val, escaped, terse) {
if (key === 'style') {
val = exports.style(val);
}
if ('boolean' == typeof val || null == val) {
if (val) {
return ' ' + (terse ? key : key + '="' + key + '"');
} else {
return '';
}
} else if (0 == key.indexOf('data') && 'string' != typeof val) {
if (JSON.stringify(val).indexOf('&') !== -1) {
console.warn('Since Jade 2.0.0, ampersands (`&`) in data attributes ' +
'will be escaped to `&amp;`');
};
if (val && typeof val.toISOString === 'function') {
console.warn('Jade will eliminate the double quotes around dates in ' +
'ISO form after 2.0.0');
}
return ' ' + key + "='" + JSON.stringify(val).replace(/'/g, '&apos;') + "'";
} else if (escaped) {
if (val && typeof val.toISOString === 'function') {
console.warn('Jade will stringify dates in ISO form after 2.0.0');
}
return ' ' + key + '="' + exports.escape(val) + '"';
} else {
if (val && typeof val.toISOString === 'function') {
console.warn('Jade will stringify dates in ISO form after 2.0.0');
}
return ' ' + key + '="' + val + '"';
}
};
/**
* Render the given attributes object.
*
* @param {Object} obj
* @param {Object} escaped
* @return {String}
*/
exports.attrs = function attrs(obj, terse){
var buf = [];
var keys = Object.keys(obj);
if (keys.length) {
for (var i = 0; i < keys.length; ++i) {
var key = keys[i]
, val = obj[key];
if ('class' == key) {
if (val = joinClasses(val)) {
buf.push(' ' + key + '="' + val + '"');
}
} else {
buf.push(exports.attr(key, val, false, terse));
}
}
}
return buf.join('');
};
/**
* Escape the given string of `html`.
*
* @param {String} html
* @return {String}
* @api private
*/
var jade_encode_html_rules = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;'
};
var jade_match_html = /[&<>"]/g;
function jade_encode_char(c) {
return jade_encode_html_rules[c] || c;
}
exports.escape = jade_escape;
function jade_escape(html){
var result = String(html).replace(jade_match_html, jade_encode_char);
if (result === '' + html) return html;
else return result;
};
/**
* Re-throw the given `err` in context to the
* the jade in `filename` at the given `lineno`.
*
* @param {Error} err
* @param {String} filename
* @param {String} lineno
* @api private
*/
exports.rethrow = function rethrow(err, filename, lineno, str){
if (!(err instanceof Error)) throw err;
if ((typeof window != 'undefined' || !filename) && !str) {
err.message += ' on line ' + lineno;
throw err;
}
try {
str = str || require('fs').readFileSync(filename, 'utf8')
} catch (ex) {
rethrow(err, null, lineno)
}
var context = 3
, lines = str.split('\n')
, start = Math.max(lineno - context, 0)
, end = Math.min(lines.length, lineno + context);
// Error context
var context = lines.slice(start, end).map(function(line, i){
var curr = i + start + 1;
return (curr == lineno ? ' > ' : ' ')
+ curr
+ '| '
+ line;
}).join('\n');
// Alter exception message
err.path = filename;
err.message = (filename || 'Jade') + ':' + lineno
+ '\n' + context + '\n\n' + err.message;
throw err;
};
exports.DebugItem = function DebugItem(lineno, filename) {
this.lineno = lineno;
this.filename = filename;
}
},{"fs":2}],2:[function(require,module,exports){
},{}]},{},[1])(1)
});