Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove terrible code, support JSON builds, be more inline with Panino

  • Loading branch information...
commit bc4e1ae31e003597e0fe077bc62122037821d615 1 parent 4da9831
@gjtorikian authored
View
6 .npmignore
@@ -1,6 +0,0 @@
-.DS_Store
-out/
-src/
-node_modules/
-templates/
-resources/
View
16 LICENSE
@@ -1,14 +1,8 @@
-Copyright (C) 2012 Garen J. Torikian
+The MIT License (MIT)
+Copyright (c) 2012 Garen J. Torikian
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+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:
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
+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.
View
65 README.md
@@ -6,9 +6,6 @@ What's black and white and read all over?
This is a documentation build system that takes Markdown files as sources, and produces HTML files. It runs on [Node.js](http://nodejs.org/), and uses [Jade](http://jade-lang.com/) as its templating engine.
-A lot of the concepts are based on [maximebf's "beautiful-docs"](https://github.com/maximebf/beautiful-docs), but there are so many differences--the most notable being that this is in Javascript, not Coffeescript--that I decided to turn it into a complete fork.
-
-
## Features
- Markdown syntax using [NAMP](https://github.com/gjtorikian/namp). NAMP supports:
@@ -18,10 +15,11 @@ A lot of the concepts are based on [maximebf's "beautiful-docs"](https://github.
* Conversion of `Note: `, `Tip: `, and `Warning: ` blocks into [Twitter Bootstrap alert blocks](http://twitter.github.com/bootstrap/components.html#alerts)
For more information, check out the NAMP documentation.
- Support for [content references (conrefs) in Markdown](https://github.com/gjtorikian/markdown_conrefs)
- - Pass in individual files or entire directories
+ - Pass in individual files or entire directories; exclude files and directories with glob matching
- Embeddable metadata
- - Easy template customization (via Jade)
- - Automatic linking for all heading tags (`h1`, `h2`, _e.t.c._)
+ - Easy template customization
+ - Automatic linking for all heading tags (`h1`, `h2`, _e.t.c._), as well as automatic table of headers generation
+ - Provides a JSON format
## Installation
@@ -31,24 +29,20 @@ Make sure you have a recent build of Node.js (this was tested on v0.6.0). Instal
Want to try a demonstration? Then clone this repository, and run
- node bin/panda-docs src/manifest.json
+ node build.js
That'll turn this README into a better looking HTML file in the _/out_ directory.
## Usage
- panda-docs </path/to/manifest.json> _[options]_
-
-The _manifest.json_ file is mandatory, and all other options are optional. The default output directory here is _./out_.
-
-If you'd like to use `panda-docs` in a script, you can! Simply define one like this:
+Use `panda-docs` in a script! Simply define a file similar to this one:
```javascript
var options = {
title: "Panda (from script)"
}
-panda.make("./src/manifest.json", options, function(err, cbReturn) {
+panda.make(["./src/"], options, function(err, cbReturn) {
if (err) {
console.error(err);
}
@@ -57,27 +51,7 @@ panda.make("./src/manifest.json", options, function(err, cbReturn) {
You can find out more information on options you can use below:
-### Manifest Files
-
-A manifest file is a mandatory JSON file that indicates where your source files reside, as well as specifing customization options for your documentation pages.
-
-A manifest file can have the properties listed below. All the properties are optional, with the exception of `files`.
-
- - `files`: An array defining the path to your files
- - `resources`: An array of directories to also copy into the _/out_ directory. This is usually used for accompanying or inline images.
- - `extension`: The extension of your Markdown files. Some people use `.md`, others `.markdown`, and still others `.text`. This is optional, and defaults to `.md`.
- - `home`: The file to display as the manual homepage (this won't show up in the TOC)
- - `codeHighlightTheme`: The name of [the highlightjs theme to use](http://softwaremaniacs.org/soft/highlight/en/) for code highlighting (defaults to 'github')
-
-As noted above, files can either be absolute URIs, or relative to the manifest file. For example:
-
- {
- "files": ["README.md", "../../someFile.md"]
- }
-
-Note that every file must have ONE `h1` tag. This is used to generate the page's title information.
-
-### Options
+### Available Options
There are a number of arguments you can pass to Panda that affect the entire build. They are:
@@ -103,21 +77,12 @@ You have to specify at least one Jade file as a template for your pages. Within
* `manifest` is an object containing the Manifest.json properties
* `toh` is an object containing the headings for each file (`h1`, `h2`, _e.t.c._). See below for more information on this object.
* `headingTable` is a function you can use to generate a list of your page's table of contents. See below for more information on using this
-* `options` is an object containing your passed in properties
* `fileName` is the name of the resulting file (without the extension)
* `title` is the title of the documentation
* `pageTitle` is the title of the current page
* `mtime` indicates the last modified time of your source file
-## Callback Results
-
-The callback for `panda` returns a JSON with one key: `files`, which is a listing of all the files generated. `files` is an array of objects, containing the following keys:
-
-* `filename`: the filename (minus the suffix)
-* `mtime`: the last modified time of your source file
-* `pageTitle`: the title of the page (text only, meaning minus any `#` or `<h1>` indicators)
-
-You could use this information to provide a list of Recently Updated content--which is exactly what the [Cloud9 IDE User Documentation](https://github.com/c9/cloud9ide-documentation) does.
+All your passed in `options` are also available.
#### Working with a Table of Contents for a Page
@@ -211,4 +176,14 @@ Thus, to generate the above, your Jade template might go:
```
!= headingTable(toh, 5, ['tocContainer', 'tocItem'])
-```
+```
+
+## Callback Results
+
+The callback for `panda` returns a JSON with one key: `files`, which is a listing of all the files generated. `files` is an array of objects, containing the following keys:
+
+* `filename`: the filename (minus the suffix)
+* `mtime`: the last modified time of your source file
+* `pageTitle`: the title of the page (text only, meaning minus any `#` or `<h1>` indicators)
+
+You could use this information to provide a list of Recently Updated content--which is exactly what the [Cloud9 IDE User Documentation](https://github.com/c9/cloud9ide-documentation) does.
View
113 bin/panda-docs
@@ -1,113 +0,0 @@
-#!/usr/bin/env node
-
-/*
-Panda - A total documentation build system for technical writers, and those who want to be like them.
-
-Copyright (C) 2012 Garen J. Torikian, licensed under GPL.
-*/
-
-var panda = require('../index.js'),
- fs = require('fs'),
- path = require('path'),
- wrench = require('wrench'),
- funcDocs = require('functional-docs');
-
-var async = require('async');
-var helpers = require('../lib/helpers');
-
-var cli = require('../lib/cli');
-
-var panda_docs = exports;
-var manifestFile;
-
-
-panda_docs.make = exports.make = function(manifestFile, args, callback) {
- var options = cli.parseArgs();
-
- for (var key in args) {
- if (args.hasOwnProperty(key)) {
- options[key] = args[key];
- }
- }
-
- destDir = options.output;
-
- manifests = [];
-
- if (!options.keepOutDir) {
- wrench.rmdirSyncRecursive(destDir, true);
- }
-
- wrench.mkdirSyncRecursive(destDir, 0777);
-
- cbReturn = {};
- cbReturn.files = [ ];
-
- async.series([
- function(cb) {
- if (manifestFile !== undefined && fs.statSync(manifestFile)) {
- console.log("Generating documentation from manifest '" + manifestFile + "'");
- panda.open(manifestFile, function(err) {
- cb(null);
- });
- }
- else {
- console.error("Manifest " + manifestFile + " doesn't appear to exist!");
- process.exit(1);
- }
- },
- function(cb) {
- panda.makeConrefs(function () {
- cb(null);
- });
- },
- function(cb) {
- panda.createGenerator(options, function() {
- cb(null);
- });
- },
- function(cb) {
- if (options.assets) {
- panda.copyAssets(options.assets, options.outputAssets, function() {
- cb(null);
- });
- }
- else
- cb(null);
- },
- function(cb) {
- panda.copyResources(options.output, function() {
- cb(null);
- });
- },
- function(cb) {
- panda.render(cbReturn, function(err) {
- cb(err);
- });
- }
- ], function(err, results) {
- if (err) return callback(err);
-
- if (options.disableTests !== true) {
- funcDocs.runTests([destDir], {stopOnFail: false, ext: ".html"}, function(err) {
- if (err) return callback(err);
-
- console.log("Finished " + manifestFile + " generation");
- return callback(null, cbReturn);
- });
- }
- else
- return callback(null, cbReturn);
- });
-}
-
-// Not from the outside? Then it's from the command line
-if (!module.parent) {
- exports.make(process.argv.slice(2), function(err) {
- if (err) {
- console.error(err);
- process.exit(1);
- }
- process.exit(0);
- });
-}
View
8 build.js
@@ -1,10 +1,12 @@
-var panda = require("./bin/panda-docs");
+var panda = require("./index");
var options = {
- title: "Panda (from script)"
+ title: "Panda (from script)",
+ assets: "./templates/default/assets",
+ outputAssets: "./out/assets"
}
-panda.make("./src/manifest.json", options, function(err, cbReturn) {
+panda.make(["./README.md"], options, function(err, cbReturn) {
if (err) {
console.error(err);
}
View
163 index.js
@@ -1,73 +1,130 @@
var fs = require('fs'),
path = require('path');
-var Manifest = require('./lib/manifest'),
- Generator = require('./lib/generator');
+var Generator = require('./lib/generator'),
+ helpers = require('./lib/helpers'),
+ cli = require('./lib/cli');
var conrefs = require('markdown_conrefs'),
jade = require('jade'),
- async = require('async'),
- wrench = require('wrench');
-
-//exports.Manifest = Manifest;
-exports.Generator = Generator;
-
-exports.open = function(filename, callback) {
- Manifest.open(filename, callback);
-};
-
-exports.makeConrefs = function(cb) {
- conrefs.init(Manifest.options.files);
- cb(null);
-};
-
-exports.createGenerator = function(options, callback) {
- Generator.createGenerator(options, callback);
-};
-
-exports.copyAssets = function(srcDir, destDir, callback) {
- console.log("Copying assets to " + destDir + "...");
- wrench.mkdirSyncRecursive(destDir, 0777);
- wrench.copyDirSyncRecursive(srcDir, destDir, {preserve: true});
- callback(null);
-};
-
-exports.copyResources = function(destDir, callback) {
- if (Manifest.options.resources !== undefined) {
- console.log("Copying resources...");
- var manifestDir = path.dirname(Manifest.uri);
-
- Manifest.options.resources.forEach(function (src) {
- var item = path.resolve(manifestDir, src);
- wrench.copyDirSyncRecursive(item, destDir + "/" + path.basename(item));
- });
- callback(null);
- } else {
- callback(null);
- }
-};
-
-exports.render = function(cbReturn, callback) {
- var jadeTemplateFile = Generator.options.template;
+ wrench = require('wrench'),
+ funcDocs = require('functional-docs'),
+ async = require('async');
+
+var panda_docs = exports;
+var files;
+
+panda_docs.make = exports.make = function(paths, _options, callback) {
+ var options = cli.parseArgs(paths);
+
+ for (var key in _options) {
+ if (_options.hasOwnProperty(key)) {
+ options[key] = _options[key];
+ }
+ }
+
+ destDir = options.output;
+
+ if (!options.keepOutDir) {
+ wrench.rmdirSyncRecursive(destDir, true);
+ }
+
+ wrench.mkdirSyncRecursive(destDir);
+
+ cbReturn = {};
+ cbReturn.files = [ ];
+
+ async.series([
+ function(cb) {
+ if (options.extension.charAt(0) !== ".")
+ options.extension = "." + options.extension;
+
+ cli.findFiles(options.paths, options.excludes, options.extension, function(err, _files) {
+ files = _files;
+ cb(err);
+ });
+ },
+
+ function(cb) {
+ conrefs.init(files);
+ cb(null);
+ },
+
+ function(cb) {
+ if (options.assets) {
+ var outAssetsDirName = options.outputAssets || path.join(options.output, path.basename(options.assets));
+
+ console.log("Copying assets to " + outAssetsDirName + "...");
+ wrench.mkdirSyncRecursive(outAssetsDirName);
+ wrench.copyDirSyncRecursive(options.assets, outAssetsDirName, {preserve: true});
+ }
+ if (options.resources) {
+ var outResourcesDirName = options.outputResources || path.join(options.output, path.basename(options.resources));
+
+ console.log("Copying resources to " + outResourcesDirName + "...");
+
+ wrench.mkdirSyncRecursive(outResourcesDirName);
+ wrench.copyDirSyncRecursive(options.resources, outResourcesDirName, {preserve: true});
+ }
+ cb(null);
+ },
+
+ function(cb) {
+ render(options, cbReturn, function(err) {
+ cb(err);
+ });
+ },
+
+ function(cb) {
+ var outputJson = cbReturn;
+
+ outputJson.baseUrl = options.baseUrl;
+ outputJson.title = options.title;
+
+ fs.writeFile(path.join(options.output, "docs.json"), JSON.stringify(outputJson, null, " "), function(err) {
+ cb(err);
+ });
+ }
+ ], function(err, results) {
+ if (err) return callback(err);
+
+ if (options.disableTests !== true) {
+ funcDocs.runTests([destDir], {stopOnFail: false, ext: ".html"}, function(err) {
+ if (err) return callback(err);
+
+ return callback(null, cbReturn);
+ });
+ }
+ else
+ return callback(null, cbReturn);
+ });
+}
+
+function render(options, cbReturn, callback) {
+ var jadeTemplateFile = options.skin;
var jadeTemplate = fs.readFileSync(jadeTemplateFile, 'utf8');
- var jadeCompileFn = jade.compile(jadeTemplate, {filename: jadeTemplateFile, pretty: false});
+ var jadeCompileFn = jade.compile(jadeTemplate, {filename: jadeTemplateFile, pretty: true});
console.log("Building files...");
- async.forEach(Manifest.options.files, function(filepath, addPageTitle) {
+ async.forEach(files, function(filepath, cb) {
fs.stat(filepath, function (err, stats) {
if (err) return callback(err);
var mtime = stats.mtime.valueOf();
- var filename = path.basename(filepath, Manifest.options.extension);
+ var filename = path.basename(filepath, options.extension);
fs.readFile(filepath, 'utf8', function(err, data) {
if (err) return callback(err);
- cbReturn.files.push({});
- cbReturn.files[cbReturn.files.length - 1].filename = filename;
- cbReturn.files[cbReturn.files.length - 1].mtime = mtime;
- cbReturn.files[cbReturn.files.length - 1].pageTitle = data.split("\n")[0].substring(2);
+ var fileObj = {};
+ fileObj.filename = filename;
+ fileObj.mtime = mtime;
+ fileObj.pageTitle = data.split("\n")[0].substring(2);
- Generator.render(Manifest.options, jadeCompileFn, filepath, filename, data, mtime, addPageTitle);
+ Generator.render(options, jadeCompileFn, filepath, filename, data, mtime, function(err, html) {
+ fileObj.contents = html;
+ cbReturn.files.push(fileObj);
+ cb(null);
+ });
});
});
}, function(err, results) {
View
107 lib/cli.js
@@ -1,3 +1,8 @@
+var fs = require('fs'),
+ path = require('path');
+
+var FsTools = require('fs-tools');
+
var argparse = require('argparse');
var ArgumentParser = argparse.ArgumentParser;
@@ -10,6 +15,30 @@ var cli = module.exports = new ArgumentParser({
}
});
+cli.addArgument(['paths'], {
+ help: 'Source files location',
+ metavar: 'PATH',
+ action: 'append',
+ nargs: '+'
+});
+
+
+cli.addArgument(['--excludes'], {
+ help: 'Glob patterns of filenames to exclude ' +
+ '(you can use wildcards: ?, *, **).',
+ dest: 'excludes',
+ metavar: 'PATTERN',
+ action: 'append',
+ defaultValue: []
+});
+
+cli.addArgument(['--extension'], {
+ help: 'The extension of your Markdown files. [.md]',
+ dest: 'extension',
+ metavar: 'STRING',
+ defaultValue: '.md'
+});
+
cli.addArgument(['-o', '--output'], {
help: 'Resulting file(s) location [out]',
dest: 'output',
@@ -51,6 +80,12 @@ cli.addArgument(['--assets'], {
metavar: 'PATH'
});
+cli.addArgument(['-e', '--resources'], {
+ help: 'A resources directory to also copy into the _/out_ directory. This is usually used for accompanying or inline images.',
+ dest: 'resources',
+ metavar: 'PATH'
+});
+
cli.addArgument(['-d', '--disableTests'], {
help: 'Disables the test suite that runs at the end of an HTML build. This is NOT recommended.',
dest: 'disableTests',
@@ -72,9 +107,79 @@ cli.addArgument(['--keepFirstHeader'], {
defaultValue: false
});
+cli.addArgument(['--codeHighlightTheme'], {
+ help: ' The name of the highlightjs theme to use for code highlighting',
+ dest: 'codeHighlightTheme',
+ action: 'storeTrue',
+ metavar: 'STRING',
+ defaultValue: 'github'
+});
+
cli.addArgument(['--baseUrl'], {
help: 'Base url of all links [./]',
dest: 'baseUrl',
metavar: 'STRING',
defaultValue: './'
-});
+});
+
+cli.findFiles = function findFiles(paths, excludes, extension, callback) {
+ var entries = [];
+
+ // prepare matchers matchers
+ if (excludes.length > 0) {
+ excludes = excludes.map(excludes || [], function (p) {
+ return isFunction(p) ? {test: p} : minimatch.makeRe(p);
+ });
+ }
+
+ // make a copy consisting valueble paths only
+ paths = paths.filter(function (p) { return !!p; });
+
+ function isFunction(obj) {
+ return typeof obj === 'function';
+ }
+
+ function process(filename, lstats) {
+ var include = true;
+
+ if (0 < excludes.length) {
+ include = !_.any(excludes, function (filter) {
+ return filter.test(filename, lstats);
+ });
+ }
+
+ if (include && path.extname(filename) == extension) {
+ entries.push(filename);
+ }
+ }
+
+ function walk(err) {
+ var pathname, lstats;
+
+ // get next path
+ pathname = paths.shift();
+
+ // skip empty path or report real error
+ if (err || !pathname) {
+ callback(err, entries.sort());
+ return;
+ }
+
+ // get lstats of the pathname
+ lstats = fs.lstatSync(pathname);
+
+ if (!lstats.isDirectory()) {
+ // process non-directories directly
+ process(pathname, lstats);
+ walk();
+ return;
+ }
+
+ FsTools.walk(pathname, function (filename, lstats, next) {
+ process(filename, lstats);
+ next();
+ }, walk);
+ }
+
+ walk();
+};
View
22 lib/generator.js
@@ -7,19 +7,8 @@ var helpers = require('./helpers'),
conrefs = require('markdown_conrefs');
Generator = module.exports;
-var options = { };
-exports.options = options;
-Generator.createGenerator = function(options, callback) {
- Generator.options = helpers.extend({
- assetsDir: options.assets,
- template: options.skin,
- }, options);
-
- callback(null);
-}
-
-Generator.render = function(manifest, jadeCompileFn, filepath, filename, srcContent, mtime, callback) {
+Generator.render = function(options, jadeCompileFn, filepath, filename, srcContent, mtime, callback) {
var replacedContent = conrefs.replaceConref(srcContent);
var toh = tohGenerator.generate(replacedContent);
@@ -39,7 +28,7 @@ Generator.render = function(manifest, jadeCompileFn, filepath, filename, srcCont
}
// remove h1 now
- if (!this.options.keepFirstHeader) {
+ if (!options.keepFirstHeader) {
replacedContent = replacedContent.replace(found.text, "");
}
@@ -52,8 +41,7 @@ Generator.render = function(manifest, jadeCompileFn, filepath, filename, srcCont
content = tohGenerator.autoLinkifyHeaders(content);
var jadeParams = {};
- jadeParams = helpers.extend(this.options, {
- manifest: manifest,
+ jadeParams = helpers.extend(options, {
content: content,
toh: toh,
headingTable: tohGenerator.headingTable,
@@ -66,7 +54,7 @@ Generator.render = function(manifest, jadeCompileFn, filepath, filename, srcCont
var html = jadeCompileFn(jadeParams);
- fs.writeFile(this.options.output + "/" + filename + ".html", html, 'utf8', function(err) {
- return callback(err);
+ fs.writeFile(options.output + "/" + filename + ".html", html, 'utf8', function(err) {
+ callback(err, html);
});
};
View
116 lib/manifest.js
@@ -1,116 +0,0 @@
-var Manifest, ManifestFile, generateSlug;
-
-var fs = require('fs'),
- path = require('path'),
- url = require('url'),
- util = require('util');
-
-var helpers = require('./helpers');
-
-var async = require('async'),
- findit = require('findit');
-
-Manifest = module.exports;
-
-generateSlug = function(str) {
- str = str.toLowerCase();
- str = str.replace(/^\s+|\s+$/g, "");
- str = str.replace(/[\/_|\s]+/g, "-");
- str = str.replace(/[^a-z0-9-]+/g, "");
- str = str.replace(/[-]+/g, "-");
- return str = str.replace(/^-+|-+$/g, "");
-};
-
-Manifest.open = function(manifestFile, callback) {
- Manifest.uri = manifestFile;
- var data = fs.readFileSync(manifestFile, 'utf8');//, function(err, data) {
- // if (err) return callback(err);
-
- var files, options, _ref;
-
- // grab the manifest options
- options = JSON.parse(data);
- if (options.home) files.unshift(options.home);
-
- if (options.files === undefined) {
- console.error("You have no files defined! Panda can do nothing for you.");
- process.exit(0);
- }
- if (options.extension === undefined) {
- options.extension = ".md";
- }
- else {
- if (options.extension.charAt(0) != ".") { // e.g. "md", add the '.'
- options.extension = "." + options.extension;
- }
- }
-
- Manifest.options = options;
-
- async.map(Manifest.options.files, checkDir, function(err, results) {
- // unfortunate necessity; .on('directory') below returns an array, there's no way
- // that I can tell to actually replace an element with many more elements
- var subArray = [];
- for (var i = 0; i < results.length; i++) {
- if (Array.isArray(results[i])) {
- var dirArray = results[i];
- dirArray.forEach(function (f) {
- subArray.push(f);
- });
- results.splice(i, 1);
- i--;
- }
- }
- results = results.concat(subArray);
- Manifest.options.files = eliminateDuplicates(results);
- callback(err);
- });
-};
-
-function checkDir(item, callback) {
- var manifestDir = path.dirname(Manifest.uri);
- var results = [], item = path.resolve(manifestDir, item);
-
- fs.stat(item, function(err, stats) {
- if (stats === undefined) {
- console.error("stats is undefined for " + item);
- }
- if (stats.isDirectory()) {
- var finder = findit.find(item);
-
- finder.on('file', function (file, stat) {
- if (path.extname(file) == Manifest.options.extension) {
- results.push(file);
- }
- });
-
- finder.on('directory', function (dir, stat) {
- //console.log("Digging into " + dir);
- });
-
- finder.on('end', function () {
- callback(err, results);
- });
- }
- else if (path.extname(item) == Manifest.options.extension) {
- callback(err, item);
- }
- });
-}
-
-function eliminateDuplicates(arr) {
- var i,
- len=arr.length,
- out=[],
- obj={};
-
- for (i=0;i<len;i++) {
- obj[arr[i]]=0;
- }
- for (i in obj) {
- if (i !== undefined && i !== '') {
- out.push(i);
- }
- }
- return out;
-}
View
25 package.json
@@ -1,11 +1,11 @@
{
"name": "panda-docs",
- "version": "0.3.21",
+ "version": "0.4.0",
"author": "Garen Torikian",
"keywords": ["documentation", "docs", "markdown"],
"description": "A complete documentation generation tool for Markdown files",
"licenses": [{
- "type": "GPL",
+ "type": "MIT",
"url": "http://github.com/gjtorikian/panda-docs/raw/master/LICENSE"
}],
@@ -15,16 +15,17 @@
},
"dependencies": {
- "namp": ">=0.1.8",
- "async": ">=0.1.18",
- "wrench": ">=1.3.8",
- "jade": ">=0.26.1",
- "argparse" : ">=0.1.3",
- "markdown_conrefs": ">=1.2.3",
- "findit": ">=0.1.2",
- "functional-docs": ">=0.1.10"
+ "namp": "",
+ "async": "",
+ "wrench": "",
+ "jade": "",
+ "argparse" : "",
+ "markdown_conrefs": "",
+ "findit": "",
+ "functional-docs": "",
+ "minimatch" : "",
+ "fs-tools" : ""
},
- "bin": { "panda-docs": "bin/panda-docs" },
- "main": "bin/panda-docs"
+ "main": "index.js"
}
View
BIN  resources/images/gnu.jpg
Deleted file not rendered
View
7 src/manifest.json
@@ -1,7 +0,0 @@
-{
- "files": ["../README.md"],
- "resources": ["../resources"],
- "extension": ".md",
- "codeHighlightTheme": "solarized_dark",
- "github": "gjtorikian/namp"
-}
View
21 templates/default/layout.jade
@@ -1,12 +1,12 @@
!!! 5
--var codeHighlightTheme = manifest.codeHighlightTheme || 'github'
+-var codeHighlightTheme = codeHighlightTheme
html
head
meta(http-equiv="content-type", content="text/html", charset=utf-8")
- title #{options.title}
+ title #{title}
link(type="text/css", rel="stylesheet", href="http://fonts.googleapis.com/css?family=Droid+Sans&subset=latin")
link(type="text/css", rel="stylesheet", href="./assets/csses/reset.css")
@@ -14,22 +14,13 @@ html
link(type="text/css", rel="stylesheet", href="./assets/csses/print.css", media="print")
link(type="text/css", rel="stylesheet", href="http://yandex.st/highlightjs/6.1/styles/#{codeHighlightTheme}.min.css")
- if manifest.css
- link(type="text/css", rel="stylesheet", href="#{manifest.css}")
-
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
-
- if manifest.embedly
- <script type="text/javascript" src="http://scripts.embed.ly/jquery.embedly.min.js"></script>
- <script type="text/javascript">$(function(){$('#content p:not(.disable-embedly) a:only-child').parent().embedly({key:'<%= @manifest.embedly %>',maxWidth: 700});});</script>
-
- <script type="text/javascript" src="#{options.baseUrl}/js/viewer.js"></script>
body
div#page
a(name="top")
- if !options.noHeader
+ if keepFirstHeader
header#header
h1 Panda: Readme
@@ -37,9 +28,5 @@ html
footer#footer
From <a href="http://github.com/gjtorikian/panda">github.com/gjtorikian/panda</a> -
- <a href="#top">Back to top</a> - <a href="#{options.baseUrl}/all.html">Everything on a single page</a>
- <a href="?print=1">Print current page</a> - <a href="#{options.baseUrl}/all.html?print=1">Print all pages</a>
+ <a href="#top">Back to top</a>
-
- if manifest.github
- a(href="https://github.com/#{manifest.github}", id="fork-me-on-github") Fork me on Github
Please sign in to comment.
Something went wrong with that request. Please try again.