Permalink
Browse files

Initial quick & dirty version (very quick & very dirty)

  • Loading branch information...
0 parents commit 3f5577fcbf7e90191c756461153efa7d43148411 @yrashk yrashk committed Dec 21, 2010
Showing with 569 additions and 0 deletions.
  1. +62 −0 LICENSE
  2. +7 −0 README
  3. +83 −0 app.js
  4. +417 −0 showdown.js
62 LICENSE
@@ -0,0 +1,62 @@
+Copyright (c) 2010, Yurii Rashkovskii. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+Showdown license:
+
+Copyright (c) 2007, John Fraser
+<http://www.attacklab.net/>
+All rights reserved.
+
+Original Markdown copyright (c) 2004, John Gruber
+<http://daringfireball.net/>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+* Neither the name "Markdown" nor the names of its contributors may
+ be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+This software is provided by the copyright holders and contributors "as
+is" and any express or implied warranties, including, but not limited
+to, the implied warranties of merchantability and fitness for a
+particular purpose are disclaimed. In no event shall the copyright owner
+or contributors be liable for any direct, indirect, incidental, special,
+exemplary, or consequential damages (including, but not limited to,
+procurement of substitute goods or services; loss of use, data, or
+profits; or business interruption) however caused and on any theory of
+liability, whether in contract, strict liability, or tort (including
+negligence or otherwise) arising in any way out of the use of this
+software, even if advised of the possibility of such damage.
7 README
@@ -0,0 +1,7 @@
+How to start:
+
+$ make deps && make
+$ cd ../beamjs
+$ ./beamjs -sname beam -pa ../beamjs_misultin/ebin -pa ../beamjs_misultin/deps/misultin/ebin/ -mod http beamjs_misultin -jseval "listenPort=8080" -load ../beamjs_doc_browser/app.js
+
+
83 app.js
@@ -0,0 +1,83 @@
+var http = require('http');
+var global = { events: require('events'),
+ require: require,
+ console: console,
+ sys: require('sys'),
+ messaging: require('messaging'),
+ dist: require('dist')
+ };
+
+require.paths.unshift(__dirname);
+require('showdown');
+var _showdown = new Showdown.converter();
+var handler = function(request, response) {
+ if (request.path == "/favicon.ico") {
+ response.writeHead(404,{});
+ return;
+ }
+
+ var tokens = request.path.split("/");
+ tokens.shift();
+
+ var moduleName = tokens.shift();
+ if (moduleName == "") {
+ moduleName = "";
+ module = global;
+ } else {
+ var module = global[moduleName];
+ if (module == undefined) {
+ response.writeHead(200,{"Content-Type": "text/html"});
+ response.end("<h1>Module not found</h1>");
+ return;
+ }
+ }
+
+ var current = module;
+ var key = moduleName;
+ var lkey = moduleName;
+ while (tokens.length > 0) {
+ lkey = tokens.shift();
+ key += "." + lkey;
+ if ((current = current[lkey]) == undefined) {
+ response.writeHead(200,{"Content-Type": "text/html"});
+ response.end("<h1>Export not found</h1>");
+ return;
+ }
+ }
+
+ response.writeHead(200, {"Content-Type": "text/html"});
+ response.write("<html><head><title>Beam.js Doc Browser</title></head><body>");
+
+ var __doc__ = "";
+
+ if ((d = current['__doc__']) != undefined) {
+ __doc__ = _showdown.makeHtml(d);
+ }
+
+
+ response.write("<h1><em>" + typeof current + "</em> " + key + "</h1>");
+
+ response.write(__doc__);
+
+ for (_export in current) {
+ if ((_export != "__doc__") && ((typeof current[_export] == 'object') || (typeof current[_export] == 'function')))
+ {
+ vkey = lkey;
+ if (lkey != "") {
+ vkey = "/" + lkey;
+ }
+ response.write("<h2><em>" + typeof current[_export] + '</em> <a href="' + lkey + '/' + _export +'">' + _export + "</a></h2>");
+ __doc__ = ""
+ if ((d = current[_export]['__doc__']) != undefined) {
+ __doc__ = _showdown.makeHtml(d);
+ }
+ response.write(__doc__);
+ }
+ }
+
+ response.write("<hr><em>Beam.js " + global.sys.beamjs.version + "</em>");
+
+ response.end("</body></html>");
+
+};
+http.createServer(handler).listen(listenPort);
Oops, something went wrong.

0 comments on commit 3f5577f

Please sign in to comment.