From: Ian B. <ia...@co...> - 2003-01-20 09:19:34
|
On Sun, 2003-01-19 at 06:00, Beni Cherniavsky wrote: > Forgot to announce it; since the source reader is not ready for use (is > it?), It seems to work okay for me -- I think David might have some features he'd like, but what's there seems sufficient to me. > I think somebody might benefit from my solution. I've written code > that was documented with rST docstrings but couldn't use them (pydoc > ignores the rST, docutils barfs at the python code). So I took the > plain-text formatter of pydoc and hacked it until the result was a > document with chapters instead of the "| " nesting, etc., so that it could > be processed by the plain rST reader of docutils. Ack... sounds like a mess. > > Ian Bicking wrote: > > > One thing I *don't* like is reference documentation in the style of > > > pydoc.To me it's too automatic, and generally too hard to follow. > > > I find reference documentation with some framework of text (lead-in > > > paragraphs, categorization, etc) to be much better. > > > Like GNU info files tend to be? libc, elisp, make, they have the best > hierarchically organised documentation that I've ever read. Puts > everything in the right place in your head after first reading but also > allows you to quickly read just what you need. > > I'm now writing a library that I'd like to document very well, and info > files are my standard of excellence ;-). So I want to figure out a way > for creating such documentation with docutils, too. Documenting a library is different then a program, in my mind. Or at least there should be some entirely thorough but not necessarily intuitively structured documentation. In Webware I'm also making documents that are task and instruction oriented. But they don't make up for the reference documentation that you want when you're already familiar with the library, or at least the concept behind the library, and you just want to know how to spell the method name or something. This is how I use the Python reference documentation -- which on the whole is quite good -- and is how I'd expect to use a docstring extractor. I just write the other documents in a separate file. > Now that I think of it, is anyone else interested in a GNU info writer > for docutils? If yes, I'll append it to my task queue (i.e. don't hold > your breath). Info documents are often well organized, but the actual reader I've never been impressed with. I get lost too easily. But web pages certainly aren't ideal either. > > > > """ > > A general description of the highlights of the module, with > > references (interpreted text) to the details. We don't need > > a "Module" title because it will be derived automatically. > > > > This module does X, Y, Z. Most work will be done through the > > `MainClass` class. > > > > In certain cases you may wish to access the functionality > > separately, yada yada yada, and may wish to use `some_function` > > or `some_other_function` > > """ > > > > class MainClass: > > """ > > Description of this class, with references to specific > > methods like `some_method`. We don't need to fully qualify > > (no "MainClass." prefix) because "some_method" is in the > > local namespace. > > """ > > > This are closest to what I was doing. The module & class docstrings will > contain overview information, perhaphs even in many chapters, that would > link to relevant places in the low-level per-method documentation. > > The problem with this approach is that it relies too much on hyperlinks > for a good order of reading. The great thing about GNU info files is that > they are also organised in an order that is almost optimal for one-pass > front-to-back reading. Ian Bicking's idea is better because it allows you > to specify the order of the documentation entries differently from the > order of the code. I'm realizing that reordering the methods might be best anyway -- usually they don't match up with the description because they were just written in a certain order. The whole hyperlinking thing I'm still unsure about. I don't even know if there's a way to indicate that `references` should be turned into some sort of link. > > ## > > # My idea from JavaDoc is to allow document comments > > # interspersed in the code in some way, which will > > # interleave with the code objects and docstrings. > > # These would include section titles, allowing a > > # subdivision of methods by category. For example: > > > > ## > > # Magic Methods > > # ============= > > > > def __str__(self): > > """String representation of this object (pseudo-XML).""" > > ... > > > I think I see your idea. But in many some cases this is short of what's > needed. Consider (invented example) an application where many classes > contain special `gui_repr` methods that defines the user interface for > this object. They are completely irrelevant to the algorithms described > in other methods, so a good manual will probably separate the > documentation of all GUI methods into a separate chapter discussing them > all at once. When you start getting into that level or organization you have to have an application-wide view for the document. I'm just thinking of modules now -- but there certainly are many modules that aren't well contained. > So I think there should be (optional) ways to specify reordering / > reorganisation of nodes. I'm not sure how to do it in a convenient yet > flexible way. In the above gui case, for example, I would want to grab > all these methods without listing each one and risking omission. > Probably Python scripting to generate the reorganisation info would do the > trick but would not be equally applicable to non-python-source uses of > rST. I know... I've already thought of several packages I have that I'd like to autogenerate the documentation, but the format needs to be structured different from how it generally would be. For instance, in one library I have error strings that can be overridden -- these could be extracted, but only by a program that understood how my specific code was structured. > Also, for big documentation, it would make sense to hold the user-only > parts in separate files, leaving only what's relevant to the source's > design in the source. The current include directive might solve this task > too, if the reorganisation is applied later. I'm not sure what you mean here...? -- Ian Bicking Colorstudy Web Development ia...@co... http://www.colorstudy.com PGP: gpg --keyserver pgp.mit.edu --recv-keys 0x9B9E28B7 4869 N Talman Ave, Chicago, IL 60625 / (773) 275-7241 |