Browse Source

add basic doc formatter, template and generated docs for docast

formatter
Brett Langdon 11 years ago
parent
commit
c09c34ac96
3 changed files with 36 additions and 0 deletions
  1. +11
    -0
      docs/formatter.js
  2. +9
    -0
      docs/index.html
  3. +16
    -0
      docs/template.jade

+ 11
- 0
docs/formatter.js View File

@ -0,0 +1,11 @@
var jade = require('jade');
var yaml = require('js-yaml');
module.exports = function(comments){
for(var i in comments){
comments[i].doc = yaml.safeLoad(comments[i].doc);
}
var render = jade.compileFile('./template.jade');
console.log(render({comments: comments}));
};

+ 9
- 0
docs/index.html View File

@ -0,0 +1,9 @@
<!DOCTYPE html><html></html><body><h1>DocAST Documentation</h1><h3>parseFile(filename, options)</h3><pre>Parse documentation information from the provided filename argument
</pre><h5>Params</h5><ul><li>filename [String]<pre>filename of the script you wish to parse</pre></li><li>options [Object]<pre>Available options:
- tolerant: try to keep parsing the file even if errors are encountered [default: true]
</pre></li></ul><h5>Returns</h5><ul><li>[Array]<pre>a list of doc comments parsed from the source filename</pre></li></ul><h3>parseContents(contents, options)</h3><pre>Parse documentation information from the provided string content
This function is also available under `docast.parse(contents, options)`
</pre><h5>Params</h5><ul><li>contents [String]<pre>string content to parse docs from</pre></li><li>options [Object]<pre>Available options:
- tolerant: try to keep parsing the file even if errors are encountered [default: true]
</pre></li></ul><h5>Returns</h5><ul><li>[Array]<pre>a list of doc comments parsed from the source string contents</pre></li></ul></body>

+ 16
- 0
docs/template.jade View File

@ -0,0 +1,16 @@
doctype html
html
body
h1 DocAST Documentation
each comment in comments
h3=comment.name + '(' + comment.params.join(', ') + ')'
pre=comment.doc.comment
h5 Params
ul
each param in comment.doc.params
li=param.name + ' [' + param.type + ']'
pre=param.comment
h5 Returns
ul
li='[' + comment.doc.returns.type + ']'
pre=comment.doc.returns.comment

Loading…
Cancel
Save