Controller - API Usage
Path:
/src/index.coffee
compiled to/lib/index.js
This module is used as the base API. If you load the package you will get a reference to the exported methods, here. Also the CLI works through this API.
Based on the defined file filters the input folder is searched for files to check for documentation. All those files are read if not binary. The type or language of each file is auto detected to know how to parse it. Documents like markdown are directly added to as full report.
Code will be analyzed and documentation blocks will be identified and extracted. This contains the document comments, api comments and part of the code.
JsDoc like tags are interpreted and extended by autodetected information from code. For the internal view the code will also be added with syntax highlighting. Alltogethher will go in an report.
The reports will be sorted, some internal tags will be replaced and each report will be rendered as html and stored in output folder. An additional index page will be created if missing.
Sorting
The file links are sorted in a natural way. This is from upper to lower directories and alphabetically but with some defined orders. This means that ‘index.*’ always comes before ‘README.md’ and the other files.
Initialize Module
To use the template search through thealinex-config path module you have to init the template type by calling this method once.
This will setup thealinex-report component and register the template type to search for templates in the global, user and local path like known from the config module.
setup()
Usage:
setup(cb)
- Parameter
-
cb
-function(<Error>)
method, to call with ‘Error’ ornull
after done.
Create Documentation
run()
Like described in the workflow above this is the main routine and will do all the steps to make the documentation ready to browse in the local path.
Usage:
run(setup, cb)
- Parameter
-
setup
-object
defining the document creationinput
-String
path to read fromòutput
-String
output directory to store tofind
-Object
source search patternverbose
-Integer
level of verbose modeparallel
-Integer
estimated max parallel runs (default is 100 or 1 if in debug mode)
cb
-function(<Error>)
function to be called after done