Permalink
Browse files

Added --intro support for including an intro file written in markdown

  • Loading branch information...
1 parent 0f4b2e2 commit 3d48ec88327507a98d01a19d749584805a660a90 Alex Young committed Jan 20, 2011
Showing with 18 additions and 1 deletion.
  1. +1 −0 Readme.md
  2. +17 −1 lib/dox/index.js
View
@@ -46,6 +46,7 @@ Output from `--help`:
Options:
-t, --title Project title
-d, --desc Project description (markdown)
+ -i, --intro File that contains introduction text (markdown)
-s, --style Document style, available: ["default"]
-J, --no-jsdoc Disable jsdoc parsing (coverts to markdown)
-p, --private Output private code in documentation
View
@@ -56,6 +56,14 @@ var jsdoc = true;
var desc = '';
/**
+ * Intro text file name.
+ *
+ * @type String
+ */
+
+var intro = '';
+
+/**
* Show private code.
*
* @type Boolean
@@ -81,6 +89,7 @@ var usage = ''
+ 'Options:\n'
+ ' -t, --title STR Project title\n'
+ ' -d, --desc STR Project description (markdown)\n'
+ + ' -i, --intro FILE Intro file (markdown)\n'
+ ' -r, --ribbon URL Github ribbon url\n'
+ ' -s, --style NAME Document style, available: ["default"]\n'
+ ' -J, --no-jsdoc Disable jsdoc parsing (coverts to markdown)\n'
@@ -141,6 +150,10 @@ exports.parse = function(args){
case '--desc':
desc = requireArg();
break;
+ case '-i':
+ case '--intro':
+ intro = requireArg();
+ break;
case '-s':
case '--style':
style = requireArg();
@@ -171,6 +184,9 @@ exports.parse = function(args){
var head = fs.readFileSync(__dirname + '/styles/' + style + '/head.html', 'utf8');
var foot = fs.readFileSync(__dirname + '/styles/' + style + '/foot.html', 'utf8');
var css = fs.readFileSync(__dirname + '/styles/' + style + '/style.css', 'utf8');
+
+ if (intro)
+ desc = (desc || '') + fs.readFileSync(intro, 'utf8');
// Substitutions
head = head.replace(/\{\{title\}\}/g, title).replace(/\{\{style\}\}/, css);
@@ -264,4 +280,4 @@ var render = exports.render = function(str, file){
}
return html.join('\n');
-};
+};

0 comments on commit 3d48ec8

Please sign in to comment.