greenh / CJD

CJD is a system for documenting Clojure programs through the use of structured comments embedded in Clojure source code.
Other
12 stars 0 forks source link

CJD

CJD is a technology for documenting Clojure programs through the use of structured comments embedded in Clojure source code. As such, it's a supplement to or replacement for the docstring mechanism.

CJD was inspired by Javadoc, to which it bears a superficial similarity. Like Javadoc, CJD-comments support a simple form of markup that not only adds formatting detail but provides a level of metadata that describes what's being documented. This allows CJD's processing facility to extract the documentation content from collections of Clojure namespaces and convert it into trees of consistently-formatted HTML documents.

A few salient CJD features:

So, what does a CJD comment look like? Here's a taste, in the form a randomly selected function from the CJD source:

#_ (* Processes a sequence of CJD comment-content forms into a sequence 
      of flow-forms, which will in turn contain phrasing and text content.

      @arg context The context map.
      @arg contents A sequence of input forms to be parsed.
      @(returns A tuple of the form @(form [flows remaining]), where\: 
        @arg flows A sequence of flow nodes describing the parsed content
        @arg remaining Any unparsed forms in the input sequence.)
      )
(defn flow-run [context contents] . . . )

And if you'd like to see the corresponding generated output, you have your choice of dark background and light background renderings.

The CJD source is itself extensively commented using CJD, and serves as a pretty good example of CJD-based documentation can look like. You can view the full CJD documentation tree from the top in both dark background and light background forms.

For a description of how to obtain, use, and customize CJD, see the user guide. Or, for a not-terribly-reverent introduction to CJD and how it got there, check out the FAQ.

Documentation

Several documents are in the making. These are mostly complete but nonetheless works in progress, so proceed with caution!

Status

It works!

Well, after a fashion --- there are a few caveats. Some known problems, limitations, and gotchas:

And the build process is all over the floor, testing leaves everything to be desired, it doesn't result in world peace, and it hasn't freed mankind from hunger, disease, or bad guys. Or ants. (That's Leiningen's job.) But aside from all these minor details, everything is wonderful!

License

Copyright (c) 2011-2012 Howard Green. All rights reserved.

The use and distribution terms for this software are covered by the Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html at the root of this distribution. By using this software in any fashion, you are agreeing to be bound by the terms of this license.

You must not remove this notice, or any other, from this software.