PageRenderTime 1503ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 0ms

/README.md

https://bitbucket.org/nexj/njsdoc
Markdown | 72 lines | 51 code | 21 blank | 0 comment | 0 complexity | 69e2ed2ddda8b2c1f1ca31b3f25a5394 MD5 | raw file
Possible License(s): EPL-1.0
  1. # Introduction #
  2. NJSDoc is a Documentation tool for JavaScript that works by executing code.
  3. Tools like [JSDoc](https://github.com/jsdoc3/jsdoc) try to parse source code. To make this work one has structure code and comments a certain way.
  4. Often this means things get specified twice, once in code and once in comments.
  5. NJSDoc on the other hand evaluates the code using [modified Rhino](https://bitbucket.org/nexj/rhino-njsdoc) and stores the source code location of every assignment so it can calculate where
  6. each value comes from and which JSDoc comment is most appropriate. NJSDoc uses the prototype chain to classify objects as classes (constructors)
  7. and class members so it is compatible with many ad-hoc inheritance schemes.
  8. # Roadmap #
  9. * IDE integration to generate content assist for libraries - see: [https://bitbucket.org/nexj/webtools.jsdt.core](https://bitbucket.org/nexj/webtools.jsdt.core)
  10. * Prettier output that looks more like traditional JSDoc
  11. * Plugin system to support AMD and other module systems
  12. # Performance #
  13. The JQuery library can be processed in about 400ms. A large 70K LOC code-base with JSDoc comments
  14. can be processed in about 2.5 seconds.
  15. # Usage #
  16. usage: njsdoc [--list|--recipe] [--raw|--markdown|--html] [--out OUT] [--once] FILE
  17. Generate JavaScript documentation by executing JavaScript code.
  18. If --list is present then FILE is a list of paths to source files one per line.
  19. If --recipe is present then FILE is interpreted as JavaScript defining recipes and hooks.
  20. Otherwise FILE is a source file.
  21. If --out OUT is present then output will go to this file, otherwise to stdout.
  22. If --once is present then objects will be documented once even if present on both the protype and not.
  23. # Example #
  24. Get the latest version from the downloads section.
  25. $ java -jar njsdoc-0.0.2.jar jquery-1.6.3.min.js --markdown > jquery-1.6.3.min.md
  26. ## Using the --recipe option
  27. The recipe option allows one to programmatically build configuration using JavaScript.
  28. $ java -jar njsdoc-0.0.4.jar --markdown --out out.md --recipe my-recipe.js
  29. The following are examples of recipe definitions. Each expression is a recipe definition. In the example 'my-recipe.js' would
  30. contain exactly one recipe definition.
  31. // Execute files in a specific order specified by a sequence file. Like --list.
  32. //NJSDoc.defineSequence(<base path>, <list of paths, one per line>, [optional line filter regex]);
  33. NJSDoc.defineSequence("src/", "otherProjectName/src/../files.lst");
  34. NJSDoc.defineSequence("src/", "otherProjectName/src/../files.lst", "<script.*src=\"(.*)\\?");
  35. // Advanced arbitrary recipe with files, sequence files and evaluated code
  36. // file(), sequence(), and eval() can each be included zero or more times
  37. NJSDoc.recipe("mobile web")
  38. .file("external/jquery.js") // relative file path
  39. .sequence("src/", "otherProjectName/src/../files.lst") // same as defineSequence() above
  40. .sequence("src/", "otherProjectName/application.hta", "<script.*src=\"(.*)\\?") // same as defineSequence() above
  41. .eval("var g = new MyGlobalObject()") // arbitrary expressions
  42. .define(); // complete the definition
  43. // If execution order doesn't matter use modules()
  44. NJSDoc.recipe("amd based library")
  45. .file("src/sys.js")
  46. .modules({path: "src/", exclude: ["src/end.js", "src/sys.js"]})
  47. .file("end/sys.js");
  48. # See Also #
  49. * Modified Rhino required by NJSDoc: [https://bitbucket.org/nexj/rhino-njsdoc](https://bitbucket.org/nexj/rhino-njsdoc)
  50. * Eclipse plugin exposing NJSDoc API: [https://bitbucket.org/nexj/njsdoc-build](https://bitbucket.org/nexj/njsdoc-build)
  51. * Fork of the Eclipse Javascript editor JSDT using NJSDoc: [https://bitbucket.org/nexj/webtools.jsdt.core/src/njsdoc](https://bitbucket.org/nexj/webtools.jsdt.core/src/njsdoc)