sebastianbenz / Jnario

Executable specifications for Java
136 stars 38 forks source link

Change the content of the generated HTML files from the Maven plugin #121

Closed gallandarakhneorg closed 10 years ago

gallandarakhneorg commented 10 years ago

With this pull request, the HtmlFile class exhibits properties that permit to change the content of the generated files. Some of these properties may be set from the Maven's configuration of jnario-maven-report-plugin.

The added properties are:

sebastianbenz commented 10 years ago

Thanks a lot for the contribution! It definitely makes sense to provide further customization options for the generated documentation. The only thing is, that I am not sure, whether it makes sense to configure it from the maven plugin. The problem is that the features works in this case only with maven and not with the doc generator integrated into Eclipse. I would prefer a more general approach of having a properties file somewhere in the same or in one of the parent directories which contains the customizations. This has the advantage that all generators (maven, eclipse, ...) would automatically support customizing the generated documentation.

What do you think?

gallandarakhneorg commented 10 years ago

I created this pull request only to provides a possible implementation of this feature, quicly; and to start the discussion.

I agree wit you. On efficient way could be to avoid to have "hard-coded" creation of the HtmlFile instances, but use a factory in place of. In this way, it will be easier to create customized HTML generators. With injection mechanism, it will be possible to change the factory. Another way could be the use of HTML template files, put in the resources of the project. So the current HTML content will be copied into a "default" template.

Perhaps the best way will be:

I have no concrete idea on what HTML template library to use, if it exists, yet. What is your position? I may update this pull request with an updated approach.

sebastianbenz commented 10 years ago

Having clean SpecHtmlFile, FeatureHtmlFile,... interfaces would definitely be nice to have. However, we would then need to find a way to add custom implementations during runtime, which makes things complicated again.

As a first step I would prefer your approach of having static extension points which can be configured via a properties file. This could even go as far as including custom header and footer files. To simplify configuration, these files could be edited via an Eclipse preferences page.

sebastianbenz commented 10 years ago

Unfortunately, I could not integrate your pull request into the latest Jnario release as it does not yet fit the approach how we handle settings in Jnario. But it is not forgotten and I definitely would like to integrate such a feature in one of the releases.

gallandarakhneorg commented 10 years ago

This pull request is partly duplicate of #143 since I solve most of my problems concerning the structure of the tags in the generated HTML files with the generator proposed by #143. We could close this pull request without merging it.