Permalink
Browse files

More work on the documentation generation

  • Loading branch information...
1 parent a2eaa6f commit 1580c481b412f7b0db31a178b64078616bd8a266 @christkv christkv committed Jan 19, 2012
Showing with 14,380 additions and 4 deletions.
  1. +1 −1 Makefile
  2. +55 −0 deps/nodeunit/deps/console.log.js
  3. +70 −0 deps/nodeunit/deps/ejs/History.md
  4. +20 −0 deps/nodeunit/deps/ejs/Makefile
  5. +152 −0 deps/nodeunit/deps/ejs/Readme.md
  6. +14 −0 deps/nodeunit/deps/ejs/benchmark.js
  7. +531 −0 deps/nodeunit/deps/ejs/ejs.js
  8. +2 −0 deps/nodeunit/deps/ejs/ejs.min.js
  9. +5 −0 deps/nodeunit/deps/ejs/examples/client.html
  10. +7 −0 deps/nodeunit/deps/ejs/examples/list.ejs
  11. +16 −0 deps/nodeunit/deps/ejs/examples/list.js
  12. +2 −0 deps/nodeunit/deps/ejs/index.js
  13. +251 −0 deps/nodeunit/deps/ejs/lib/ejs.js
  14. +198 −0 deps/nodeunit/deps/ejs/lib/filters.js
  15. +23 −0 deps/nodeunit/deps/ejs/lib/utils.js
  16. +11 −0 deps/nodeunit/deps/ejs/package.json
  17. +173 −0 deps/nodeunit/deps/ejs/support/compile.js
  18. +269 −0 deps/nodeunit/deps/ejs/test/ejs.test.js
  19. +125 −0 deps/nodeunit/dist/nodeunit/bin/nodeunit
  20. +10 −0 deps/nodeunit/dist/nodeunit/bin/nodeunit.json
  21. +623 −0 deps/nodeunit/dist/nodeunit/deps/async.js
  22. +55 −0 deps/nodeunit/dist/nodeunit/deps/console.log.js
  23. +125 −0 deps/nodeunit/dist/nodeunit/deps/ejs.js
  24. +481 −0 deps/nodeunit/dist/nodeunit/deps/json2.js
  25. +3 −0 deps/nodeunit/dist/nodeunit/index.js
  26. +327 −0 deps/nodeunit/dist/nodeunit/lib/assert.js
  27. +316 −0 deps/nodeunit/dist/nodeunit/lib/core.js
  28. +104 −0 deps/nodeunit/dist/nodeunit/lib/nodeunit.js
  29. +121 −0 deps/nodeunit/dist/nodeunit/lib/reporters/browser.js
  30. +130 −0 deps/nodeunit/dist/nodeunit/lib/reporters/default.js
  31. +104 −0 deps/nodeunit/dist/nodeunit/lib/reporters/eclipse.js
  32. +109 −0 deps/nodeunit/dist/nodeunit/lib/reporters/html.js
  33. +14 −0 deps/nodeunit/dist/nodeunit/lib/reporters/index.js
  34. +183 −0 deps/nodeunit/dist/nodeunit/lib/reporters/junit.js
  35. +111 −0 deps/nodeunit/dist/nodeunit/lib/reporters/machineout.js
  36. +120 −0 deps/nodeunit/dist/nodeunit/lib/reporters/minimal.js
  37. +213 −0 deps/nodeunit/dist/nodeunit/lib/reporters/nested.js
  38. +107 −0 deps/nodeunit/dist/nodeunit/lib/reporters/skip_passed.js
  39. +65 −0 deps/nodeunit/dist/nodeunit/lib/reporters/tap.js
  40. +122 −0 deps/nodeunit/dist/nodeunit/lib/reporters/verbose.js
  41. +48 −0 deps/nodeunit/dist/nodeunit/lib/track.js
  42. +189 −0 deps/nodeunit/dist/nodeunit/lib/types.js
  43. +209 −0 deps/nodeunit/dist/nodeunit/lib/utils.js
  44. +65 −0 deps/nodeunit/dist/nodeunit/package.json
  45. +19 −0 deps/nodeunit/dist/nodeunit/share/junit.xml.ejs
  46. +11 −0 deps/nodeunit/dist/nodeunit/share/license.js
  47. +70 −0 deps/nodeunit/dist/nodeunit/share/nodeunit.css
  48. +7 −0 deps/nodeunit/examples/browser/suite3.js
  49. +94 −0 deps/nodeunit/examples/nested/nested_reporter_test.unit.js
  50. BIN deps/nodeunit/img/example_machineout.png
  51. +104 −0 deps/nodeunit/lib/reporters/eclipse.js
  52. +111 −0 deps/nodeunit/lib/reporters/machineout.js
  53. +213 −0 deps/nodeunit/lib/reporters/nested.js
  54. +65 −0 deps/nodeunit/lib/reporters/tap.js
  55. +122 −0 deps/nodeunit/lib/reporters/verbose.js
  56. +257 −0 deps/nodeunit/test/test-testcase-legacy.js
  57. +3 −0 deps/nodeunit_bak/.npmignore
  58. +60 −0 deps/nodeunit_bak/CONTRIBUTORS.md
  59. +19 −0 deps/nodeunit_bak/LICENSE
  60. +126 −0 deps/nodeunit_bak/Makefile
  61. +433 −0 deps/nodeunit_bak/README.md
  62. +109 −0 deps/nodeunit_bak/bin/nodeunit
  63. +10 −0 deps/nodeunit_bak/bin/nodeunit.json
  64. +623 −0 deps/nodeunit_bak/deps/async.js
  65. +125 −0 deps/nodeunit_bak/deps/ejs.js
  66. +483 −0 deps/nodeunit_bak/deps/json2.js
  67. +60 −0 deps/nodeunit_bak/doc/nodeunit.md
  68. +1,757 −0 deps/nodeunit_bak/examples/browser/nodeunit.js
  69. +12 −0 deps/nodeunit_bak/examples/browser/suite1.js
  70. +13 −0 deps/nodeunit_bak/examples/browser/suite2.js
  71. +16 −0 deps/nodeunit_bak/examples/browser/test.html
  72. BIN deps/nodeunit_bak/img/example_fail.png
  73. BIN deps/nodeunit_bak/img/example_pass.png
  74. +3 −0 deps/nodeunit_bak/index.js
  75. +316 −0 deps/nodeunit_bak/lib/assert.js
  76. +236 −0 deps/nodeunit_bak/lib/core.js
  77. +83 −0 deps/nodeunit_bak/lib/nodeunit.js
  78. +119 −0 deps/nodeunit_bak/lib/reporters/browser.js
  79. +137 −0 deps/nodeunit_bak/lib/reporters/default.js
  80. +112 −0 deps/nodeunit_bak/lib/reporters/html.js
  81. +9 −0 deps/nodeunit_bak/lib/reporters/index.js
  82. +194 −0 deps/nodeunit_bak/lib/reporters/junit.js
  83. +117 −0 deps/nodeunit_bak/lib/reporters/minimal.js
  84. +110 −0 deps/nodeunit_bak/lib/reporters/skip_passed.js
  85. +50 −0 deps/nodeunit_bak/lib/track.js
  86. +187 −0 deps/nodeunit_bak/lib/types.js
  87. +209 −0 deps/nodeunit_bak/lib/utils.js
  88. +95 −0 deps/nodeunit_bak/man1/nodeunit.1
  89. +4 −0 deps/nodeunit_bak/nodelint.cfg
  90. +53 −0 deps/nodeunit_bak/package.json
  91. +19 −0 deps/nodeunit_bak/share/junit.xml.ejs
  92. +11 −0 deps/nodeunit_bak/share/license.js
  93. +70 −0 deps/nodeunit_bak/share/nodeunit.css
  94. +4 −0 deps/nodeunit_bak/test/fixtures/coffee/mock_coffee_module.coffee
  95. +1 −0 deps/nodeunit_bak/test/fixtures/dir/mock_module3.js
  96. +1 −0 deps/nodeunit_bak/test/fixtures/dir/mock_module4.js
  97. +1 −0 deps/nodeunit_bak/test/fixtures/mock_module1.js
  98. +1 −0 deps/nodeunit_bak/test/fixtures/mock_module2.js
  99. +3 −0 deps/nodeunit_bak/test/fixtures/raw_jscode1.js
  100. +3 −0 deps/nodeunit_bak/test/fixtures/raw_jscode2.js
  101. +1 −0 deps/nodeunit_bak/test/fixtures/raw_jscode3.js
  102. +219 −0 deps/nodeunit_bak/test/test-base.js
  103. +114 −0 deps/nodeunit_bak/test/test-failing-callbacks.js
  104. +55 −0 deps/nodeunit_bak/test/test-httputil.js
  105. +214 −0 deps/nodeunit_bak/test/test-runfiles.js
  106. +125 −0 deps/nodeunit_bak/test/test-runmodule.js
  107. +46 −0 deps/nodeunit_bak/test/test-runtest.js
  108. +31 −0 deps/nodeunit_bak/test/test-sandbox.js
  109. +234 −0 deps/nodeunit_bak/test/test-testcase.js
  110. +26 −0 deps/nodeunit_bak/test/test.html
  111. +7 −2 lib/mongodb/admin.js
  112. +1 −0 package.json
  113. +1 −0 sphinx-docs/.gitignore
  114. +9 −0 sphinx-docs/source/api-documentation.rst
  115. +1 −1 sphinx-docs/source/index.rst
  116. +249 −0 tools/build-docs.js
  117. +77 −0 tools/doc-templates/class.ejs
  118. +1 −0 tools/doc-templates/function.ejs
  119. +20 −0 tools/doc-templates/index.ejs
View
@@ -60,7 +60,7 @@ clean:
rm -r ./external-libs/bson/build
generate_docs:
- # $(DOX) < lib/mongodb/admin.js > build/admin.json
$(NODE) tools/build-docs.js
+ # make --directory=./sphinx-docs --file=Makefile html
.PHONY: total
@@ -0,0 +1,55 @@
+/*
+ A console.log that won't leave you hanging when node exits
+ 90% of this file was ripped from node.js
+
+ License: see: https://github.com/joyent/node/blob/master/lib/console.js
+ */
+
+ // console object
+var formatRegExp = /%[sdj]/g;
+function format(f) {
+ var util = require('util');
+
+ if (typeof f !== 'string') {
+ var objects = [];
+ for (var i = 0; i < arguments.length; i++) {
+ objects.push(util.inspect(arguments[i]));
+ }
+ return objects.join(' ');
+ }
+
+
+ var i = 1;
+ var args = arguments;
+ var str = String(f).replace(formatRegExp, function(x) {
+ switch (x) {
+ case '%s': return String(args[i++]);
+ case '%d': return Number(args[i++]);
+ case '%j': return JSON.stringify(args[i++]);
+ default:
+ return x;
+ }
+ });
+ for (var len = args.length, x = args[i]; i < len; x = args[++i]) {
+ if (x === null || typeof x !== 'object') {
+ str += ' ' + x;
+ } else {
+ str += ' ' + util.inspect(x);
+ }
+ }
+ return str;
+}
+
+console.log = function() {
+ var res = process.stdout.write(format.apply(this, arguments) + '\n');
+
+ // this is the first time stdout got backed up
+ if (!res && !process.stdout.pendingWrite) {
+ process.stdout.pendingWrite = true;
+
+ // magic sauce: keep node alive until stdout has flushed
+ process.stdout.once('drain', function () {
+ process.stdout.draining = false;
+ });
+ }
+};
@@ -0,0 +1,70 @@
+
+0.4.3 / 2011-06-20
+==================
+
+ * Fixed stacktraces line number when used multiline js expressions [Octave]
+
+0.4.2 / 2011-05-11
+==================
+
+ * Added client side support
+
+0.4.1 / 2011-04-21
+==================
+
+ * Fixed error context
+
+0.4.0 / 2011-04-21
+==================
+
+ * Added; ported jade's error reporting to ejs. [slaskis]
+
+0.3.1 / 2011-02-23
+==================
+
+ * Fixed optional `compile()` options
+
+0.3.0 / 2011-02-14
+==================
+
+ * Added 'json' filter [Yuriy Bogdanov]
+ * Use exported version of parse function to allow monkey-patching [Anatoliy Chakkaev]
+
+0.2.1 / 2010-10-07
+==================
+
+ * Added filter support
+ * Fixed _cache_ option. ~4x performance increase
+
+0.2.0 / 2010-08-05
+==================
+
+ * Added support for global tag config
+ * Added custom tag support. Closes #5
+ * Fixed whitespace bug. Closes #4
+
+0.1.0 / 2010-08-04
+==================
+
+ * Faster implementation [ashleydev]
+
+0.0.4 / 2010-08-02
+==================
+
+ * Fixed single quotes for content outside of template tags. [aniero]
+ * Changed; `exports.compile()` now expects only "locals"
+
+0.0.3 / 2010-07-15
+==================
+
+ * Fixed single quotes
+
+0.0.2 / 2010-07-09
+==================
+
+ * Fixed newline preservation
+
+0.0.1 / 2010-07-09
+==================
+
+ * Initial release
@@ -0,0 +1,20 @@
+
+SRC = $(shell find lib -name "*.js" -type f)
+UGLIFY_FLAGS = --no-mangle
+
+test:
+ @./node_modules/.bin/expresso test/*.test.js
+
+ejs.js: $(SRC)
+ @node support/compile.js $^
+
+ejs.min.js: ejs.js
+ @uglifyjs $(UGLIFY_FLAGS) $< > $@ \
+ && du ejs.min.js \
+ && du ejs.js
+
+clean:
+ rm -f ejs.js
+ rm -f ejs.min.js
+
+.PHONY: test
@@ -0,0 +1,152 @@
+
+# EJS
+
+Embedded JavaScript templates.
+
+## Installation
+
+ $ npm install ejs
+
+## Features
+
+ * Complies with the [Express](http://expressjs.com) view system
+ * Static caching of intermediate JavaScript
+ * Unbuffered code for conditionals etc `<% code %>`
+ * Escapes html by default with `<%= code %>`
+ * Unescaped buffering with `<%- code %>`
+ * Supports tag customization
+ * Filter support for designer-friendly templates
+ * Client-side support
+
+## Example
+
+ <% if (user) { %>
+ <h2><%= user.name %></h2>
+ <% } %>
+
+## Usage
+
+ ejs.compile(str, options);
+ // => Function
+
+ ejs.render(str, options);
+ // => str
+
+## Options
+
+ - `locals` Local variables object
+ - `cache` Compiled functions are cached, requires `filename`
+ - `filename` Used by `cache` to key caches
+ - `scope` Function execution context
+ - `debug` Output generated function body
+ - `open` Open tag, defaulting to "<%"
+ - `close` Closing tag, defaulting to "%>"
+
+## Custom tags
+
+Custom tags can also be applied globally:
+
+ var ejs = require('ejs');
+ ejs.open = '{{';
+ ejs.close = '}}';
+
+Which would make the following a valid template:
+
+ <h1>{{= title }}</h1>
+
+## Filters
+
+EJS conditionally supports the concept of "filters". A "filter chain"
+is a designer friendly api for manipulating data, without writing JavaScript.
+
+Filters can be applied by supplying the _:_ modifier, so for example if we wish to take the array `[{ name: 'tj' }, { name: 'mape' }, { name: 'guillermo' }]` and output a list of names we can do this simply with filters:
+
+Template:
+
+ <p><%=: users | map:'name' | join %></p>
+
+Output:
+
+ <p>Tj, Mape, Guillermo</p>
+
+Render call:
+
+ ejs.render(str, {
+ locals: {
+ users: [
+ { name: 'tj' },
+ { name: 'mape' },
+ { name: 'guillermo' }
+ ]
+ }
+ });
+
+Or perhaps capitalize the first user's name for display:
+
+ <p><%=: users | first | capitalize %></p>
+
+## Filter list
+
+Currently these filters are available:
+
+ - first
+ - last
+ - capitalize
+ - downcase
+ - upcase
+ - sort
+ - sort_by:'prop'
+ - size
+ - length
+ - plus:n
+ - minus:n
+ - times:n
+ - divided_by:n
+ - join:'val'
+ - truncate:n
+ - truncate_words:n
+ - replace:pattern,substitution
+ - prepend:val
+ - append:val
+ - map:'prop'
+ - reverse
+ - get:'prop'
+
+## Adding filters
+
+ To add a filter simply add a method to the `.filters` object:
+
+```js
+ejs.filters.last = function(obj) {
+ return obj[obj.length - 1];
+};
+```
+
+## client-side support
+
+ include `./ejs.js` or `./ejs.min.js` and `require("ejs").compile(str)`.
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2009-2010 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+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.
@@ -0,0 +1,14 @@
+
+
+var ejs = require('./lib/ejs'),
+ str = '<% if (foo) { %><p><%= foo %></p><% } %>',
+ times = 50000;
+
+console.log('rendering ' + times + ' times');
+
+var start = new Date;
+while (times--) {
+ ejs.render(str, { cache: true, filename: 'test', locals: { foo: 'bar' }});
+}
+
+console.log('took ' + (new Date - start) + 'ms');
Oops, something went wrong.

0 comments on commit 1580c48

Please sign in to comment.