I've read a comment from Norman Ramsey about using metadata for generating documentation in lua.
I'm attempting to generate documentation from my lib, and I'd rather not use luadoc if possible.
I'd like to know more about this "metadata-oriented" method for generating documentation - methodology, examples, or programs used.
Other answers are welcome, but this is a question that probably Norman can answer better than anyone else.
Thanks!
Well, I suppose I should answer this. The code is not ready for prime time, although I might be able to get to to releasable state after July 15, 2010—and am happy to share copies before hand.
There are two ideas:
Every module has a table named
__doc. Each name in the module gets an entry in the__doctable. Here's an example:The first line is the "short documentation" of the function. My hope is that one day it can get checked dynamically, but for now it is just documentation. The rest is the "long documentation". Here are a couple more:
There are also various special fields like
__doc.__overview,__doc.T, and so on.There's a command-line tool that crawls the
__docfields and provides information. Right now this code is not very general, and the implementation is a mess. But here are some sample outputs:Overview of a whole package (note the list of undocumented items, which is critical to keeping me honest):
Short overview of one module:
Documentation of one function:
Our servers are down, but when I get a chance, I'll post a link to this code if anyone wants to play with it.