In trunk, I've got multi-purpose plugins working.
What they do is provide the name of your format inside of the plugin,
so that you can handle it appropriately.
You can also have something like:
def build_header
csv { output << data.to_csv }
text { output <<< data.join(' | ') }
end
where something like
format_name { .. }
will only run the block if the plugin is being invoked for that format.
I also added syntactic sugar for plugin registration in the form of:
renders :csv, :for => MyRenderer
For a more comprehensive example, see the simplified code from the
grouping example I posted earlier this week.
http://pastie.caboo.se/38970
You can also see the changeset which adds these features:
http://stonecode.svnrepository.com/ruport/trac.cgi/changeset/519
I'm interested in what people think of these changes. Once we add in
the smart hooks to the Report DSL, i figure they could be a pretty
helpful abstraction.