Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to document taglibs (or closures in general) in Groovy/Grails

I am writing my first taglib as part of a plugin and I would like to document it. Adding javadoc (is there any place that documents groovydoc or is it really the same thing?) Doesn't seem to work for non-methods.

Specifically, how to document the def mytag in:

/**
 * This doc shows up
 */
class MyTagLib {
  static namespace = "myns"

  /**
   * This doc does not show up, but I'd like to document attrs.
   */
  def mytag = {attrs ->
    out << "something"
  }
}

As lots of things in Grails are specified using closures, if it's really not possible to document them, then it looks like we have a problem. Is there some other solution involving separate documentation files that I should be using?

like image 557
Bart Schuller Avatar asked Jan 21 '09 12:01

Bart Schuller


1 Answers

I just read about the new Groovy 1.6 RC, which lead me to Jira, which has a couple of open bugs concerning groovydoc, including one specifically about documenting fields and properties, which is still open. The latest comment speaks of a partial implementation in trunk, so I will have to check that out.

So that clears up the current status. In the mean time, I forced myself to release my taglib into the wild and so also to document it, which I did using a regular HTML page (wiki-generated). There is something to be said for that, because I'd actually be put off if the sole docs with details on a taglib were to be found buried in lots of auto-generated dreck.

like image 133
Bart Schuller Avatar answered Oct 13 '22 09:10

Bart Schuller