Permalink
Browse files

started new docs

  • Loading branch information...
1 parent 6d9fd40 commit e5a4622cb1db3c56a4961586ca06caa58bbe5b2d @tj tj committed Feb 17, 2012
View
@@ -1,19 +1,24 @@
-SRC = $(shell find lib -type f -name "*.js")
TESTS = test/*.js
REPORTER = dot
+DOX = ./node_modules/.bin/dox
+
+SRC = $(shell find lib -type f -name "*.js")
+HTML = $(SRC:.js=.html)
test:
@NODE_ENV=test ./node_modules/.bin/mocha \
--reporter $(REPORTER) \
$(TESTS)
-docs:
- @mkdir -p docs
- @node support/docs.js $(SRC)
+docs: $(HTML)
+ @mv $(HTML) docs
+
+%.html: %.js
+ $(DOX) < $< | node support/docs > $@
docclean:
- rm -f docs/*.{html,json}
+ rm -f $(HTML)
site: docclean docs
rm -fr /tmp/docs \
View
@@ -0,0 +1,18 @@
+
+$(function(){
+ $('code').each(function(){
+ $(this).html(highlight($(this).text()));
+ });
+});
+
+function highlight(js) {
+ return js
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
+ .replace(/('.*')/gm, '<span class="string">$1</span>')
+ .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
+ .replace(/(\d+)/gm, '<span class="number">$1</span>')
+ .replace(/\bnew *(\w+)/gm, '<span class="keyword">new</span> <span class="init">$1</span>')
+ .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '<span class="keyword">$1</span>')
+}
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,161 +0,0 @@
-
-body {
- padding: 100px;
- font: 14px/1.4 'helvetica neue', helvetica, arial, sans-serif;
-}
-
-body.subpage {
- text-align: center;
-}
-
-a {
- text-decoration: none;
- color: #3b88d8;
-}
-
-a:hover {
- text-decoration: underline;
-}
-
-p.description {
- display: block;
- width: 100%;
-}
-
-h1 { font-size: 28px; }
-h2 { font-size: 20px; }
-
-pre {
- margin: 20px 0 10px 20px;
- background: #fefefe;
- padding: 20px 10px;
- -webkit-box-shadow: inset 0 0 2px rgba(0,0,0,0.2);
-}
-
-ul {
- padding: 0 15px;
-}
-
-ul li {
- margin: 0 20px;
- padding: 3px 0;
-}
-
-ul li code,
-p code {
- color: #3b88d8;
-}
-
-ul.tags {
- list-style: none;
- padding: 0;
-}
-
-ul.tags li {
- margin: 0;
-}
-
-ul.tags li em {
- font-weight: bold;
-}
-
-ul.tags li .types {
- color: #3b88d8;
-}
-
-ul.tags li.api {
- display: none;
-}
-
-.filename {
- margin-top: -40px;
- display: block;
- float: right;
- font-style: italic;
- font-size: 12px;
- color: #ccc;
-}
-
-.button {
- -webkit-user-select: none;
- display: block;
- background: #3b88d8;
- background: -moz-linear-gradient(0% 100% 90deg, #377ad0, #52a8e8);
- background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#52a8e8), to(#377ad0));
- border-top: 1px solid #4081af;
- border-right: 1px solid #2e69a3;
- border-bottom: 1px solid #20559a;
- border-left: 1px solid #2e69a3;
- -moz-border-radius: 16px;
- -webkit-border-radius: 16px;
- border-radius: 16px;
- color: #fff;
- font-family: "lucida grande", sans-serif;
- font-size: 11px;
- font-weight: normal;
- line-height: 1;
- padding: 3px 0 5px 0;
- text-align: center;
- text-shadow: 0 -1px 1px #3275bc;
- width: 112px;
- -webkit-background-clip: padding-box;
-}
-
-.button:hover {
- background: #2a81d7;
- background: -moz-linear-gradient(0% 100% 90deg, #206bcb, #3e9ee5);
- background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#3e9ee5), to(#206bcb));
- border-top: 1px solid #2a73a6;
- border-right: 1px solid #165899;
- border-bottom: 1px solid #07428f;
- border-left: 1px solid #165899;
- cursor: pointer;
- text-shadow: 0 -1px 1px #1d62ab;
- -webkit-background-clip: padding-box;
- text-decoration: none;
-}
-
-.button:active {
- background: #3282d3;
- border: 1px solid #154c8c;
- border-bottom: 1px solid #0e408e;
- text-shadow: 0 -1px 1px #2361a4;
- -webkit-background-clip: padding-box;
-}
-
-button[disabled].download-itunes,
-button[disabled].download-itunes:hover,
-button[disabled].download-itunes:active {
- background: #999;
- background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#dadada), to(#f3f3f3));
- border-top: 1px solid #c5c5c5;
- border-right: 1px solid #cecece;
- border-bottom: 1px solid #d9d9d9;
- border-left: 1px solid #cecece;
- color: #8f8f8f;
- cursor: not-allowed;
- text-shadow: 0 -1px 1px #ebebeb;
-}
-
-.button::-moz-focus-inner {
- border: 0;
- padding: 0;
-}
-
-.comment {
- margin-bottom: 80px;
-}
-
-#content {
- width: 600px;
-}
-
-pre {
- overflow-x: auto;
-}
-
-code .keyword { font-weight: bold; }
-code .comment { color: #999; }
-code .string { color: #3b88d8; }
-code .class { color: #3b88d8; font-weight: bold; }
-code .variable { color: #424242; }
View
@@ -0,0 +1,65 @@
+body {
+ padding: 50px;
+ font: 14px "Helvetica Neue", Helvetica, sans-serif;
+}
+
+h1 + p {
+ border-bottom: 2px solid #eee;
+ margin-bottom: 25px;
+ padding-bottom: 10px;
+}
+
+h2 {
+ font-weight: 200;
+}
+
+h3 {
+ font-weight: bold;
+}
+
+a {
+ color: #8a6343;
+}
+
+pre {
+ display: inline-block;
+ border: 1px solid #eee;
+ padding: 15px;
+ border-radius: 5px;
+ font: 13px Monaco, monospace;
+}
+
+.tags em {
+ font-weight: bold;
+ font-style: normal;
+}
+
+#menu {
+ position: fixed;
+ top: 10px;
+ right: 30px;
+}
+
+#menu li {
+ list-style: none;
+}
+
+#menu li a {
+ display: block;
+ text-decoration: none;
+ padding: 5px 2px;
+ border-bottom: 1px dotted #eee;
+ text-align: right;
+ -webkit-transition: padding 200ms ease-out;
+ -moz-transition: padding 200ms ease-out;
+}
+
+#menu li a:hover {
+ padding-right: 15px;
+}
+
+code .comment { color: #a2a2a2 }
+code .init { color: #2F6FAD }
+code .string { color: #5890AD }
+code .keyword { color: #8A6343 }
+code .number { color: #2F6FAD }
@@ -14,21 +14,27 @@ var utils = require('../utils')
, unauthorized = utils.unauthorized;
/**
+ * Basic Auth:
+ *
* Enfore basic authentication by providing a `callback(user, pass)`,
* which must return `true` in order to gain access. Alternatively an async
* method is provided as well, invoking `callback(user, pass, callback)`. Populates
* `req.remoteUser`. The final alternative is simply passing username / password
* strings.
*
- * Examples:
+ * Simple username and password
*
* connect(connect.basicAuth('username', 'password'));
*
+ * Callback verification
+ *
* connect()
* .use(connect.basicAuth(function(user, pass){
* return 'tj' == user & 'wahoo' == pass;
* }))
*
+ * Async callback verification, accepting `fn(err, user)`.
+ *
* connect()
* .use(connect.basicAuth(function(user, pass, fn){
* User.authenticate({ user: user, pass: pass }, fn);
@@ -15,7 +15,9 @@ var multipart = require('./multipart')
, json = require('./json');
/**
- * Parse request bodies.
+ * Body parser:
+ *
+ * Parse request bodies.
*
* By default _application/json_, _application/x-www-form-urlencoded_,
* and _multipart/form-data_ are supported, however you may map `connect.bodyParser.parse[contentType]`
@@ -32,17 +34,7 @@ var multipart = require('./multipart')
* $ curl -d 'user[name]=tj' http://localhost/
* $ curl -d '{"user":{"name":"tj"}}' -H "Content-Type: application/json" http://localhost/
*
- * Multipart configuration:
- *
- * The `options` passed are provided to each parser function.
- * The _multipart/form-data_ parser merges these with formidable's
- * IncomingForm object, allowing you to tweak the upload directory,
- * size limits, etc. For example you may wish to retain the file extension
- * and change the upload directory:
- *
- * server.use(bodyParser({ uploadDir: '/www/mysite.com/uploads' }));
- *
- * View [node-formidable](https://github.com/felixge/node-formidable) for more information.
+ * View [json](json.html), [urlencoded](urlencoded.html), and [multipart](multipart.html) for more info.
*
* @param {Object} options
* @return {Function}
@@ -31,12 +31,14 @@ exports.filter = function(req, res){
};
/**
+ * Compress:
+ *
* Compress response data with gzip/deflate.
*
* Filter:
*
- * A `filter` callback function may be passed to
- * replace the default logic of:
+ * A `filter` callback function may be passed to
+ * replace the default logic of:
*
* exports.filter = function(req, res){
* var type = res.getHeader('Content-Type') || '';
@@ -13,6 +13,8 @@
var utils = require('./../utils');
/**
+ * Cookie parser:
+ *
* Parse _Cookie_ header and populate `req.cookies`
* with an object keyed by the cookie names. Optionally
* you may enabled signed cookie support by passing
@@ -24,6 +24,8 @@ var env = process.env.NODE_ENV;
exports = module.exports = cookieSession;
/**
+ * Cookie Session:
+ *
* Cookie session middleware.
*
* Options:
View
@@ -13,6 +13,8 @@ var utils = require('../utils')
, crypto = require('crypto');
/**
+ * Anti CSRF:
+ *
* CRSF protection middleware.
*
* By default this middleware generates a token named "_csrf"
@@ -22,13 +22,15 @@ var fs = require('fs')
, extname = path.extname
, join = path.join;
-/**
+/*!
* Icon cache.
*/
var cache = {};
/**
+ * Directory:
+ *
* Serve directory listings with the given `root` path.
*
* Options:
Oops, something went wrong.

0 comments on commit e5a4622

Please sign in to comment.