broadinstitute / barclay

Command line argument parser and online documentation generation utilities for java command line programs.
BSD 3-Clause "New" or "Revised" License
9 stars 6 forks source link

Is it possible to create a custom index for each super-category? #57

Open magicDGS opened 7 years ago

magicDGS commented 7 years ago

I'm in the situation where I need an different index for each component/super-category (e.g., one index for the tools and one index for the utilities). It looks that Barclay only have support for (correct me if I'm wrong):

  1. An index template for all the documentation. This is only used once by FreeMarker for a single index.
  2. A generic template for each component. This is parsed for each @DocumentedFeature, and thus could use some macro to switch the format for each component.

It will be useful to be able to parse the i general index template (or to have several index templates) to have an index for each super-category. If there is any way to do this in the current implementation, I'm sorry to rise this issue and I would appreciate if it could be documented in the Wiki.

Thank you very much in advance.

cmnbroad commented 7 years ago

@magicDGS In general, I'd prefer to find a way to have Barclay clients do that kind of thing externally, via the templates, rather than baking more knowledge of the structure of the output into Barclay. For instance, Barclay has no knowledge of super-category at all - thats injected by the client (gatk and picard) doclet subclasses, and then extracted by their respective templates. There is a test in Barclay that simulates it, but its just a test - the Barclay docgen code itself doesn't know anything about it.

I haven't experimented much with this so I'm not sure what the requirements are, but the template that you provide doesn't have to be html. One possibility for you for the short term would be to use an xml template, which you could then post-process to fan out the various index files. I'd be curious to see how far we could get with that kind of approach.

magicDGS commented 7 years ago

Thanks for your answer. My goal is much simpler, because I'm using markdown templates with a frontmatter for jekyll. My plan for the multi-index is to create a data file for jekyll (yml) with the supercategory structure and manage that file with jekyll without depending on Barclay. This is better in my case than an xml file, but I would try this in other projects without jekyll for sure.

What I think is that it will be nice to be able to:

  1. Allow many templates for the general documentation. The index is in this category, and sub-indices could be done easily like this.
  2. A way to choose the template for each class. With macros in FreeMarker it could be done in the same file, but it will be nice to be able to have simpler templates and delegate into the doclet implementation to choose the template for each work unit. I haven't experimented enough with the docgen codd for this, so maybe it's already possible and I'm not aware of it.