-
Notifications
You must be signed in to change notification settings - Fork 283
Would you be open to a PR that adds in an option to use alternative templates? #714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement 8000 a>. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yes, this has been a long-standing feature request (see #25). In preparation of that feature, HTML generation was moved to Jinja, and user-defined CSS files were implemented in #380. I'd be very happy if someone does the work of exposing the HTML templating system to end users. However, the HTML writer is a bit of a mess, and it is unclear which variables and data structures are made available to the Jinja templates. I don't think gcovr can commit to any stability guarantees regarding the template structure, so that user-defined templates are likely to break for any gcovr updates. There's also the issue that gcovr's testing methodology is fairly fragile, comparing rendered HTML files as strings (golden master testing). Even the smallest changes to the templates will require the test reference data to be updated. So, being now aware of those potential issues, please go nuts and make gcovr better. It's very cool that you want to upstream improvements instead of forking! In addition to the ability to completely override the set of templates, consider whether the following changes could also make sense:
|
We have three kinds of html reports in the next release:
@latk mentioned in #687 (comment) that the
|
So what I think might work best and have seen in other projects is simply adjusting the directory it looks for templates. Then the onus is on the customizer to copy the existing templates, as is, and adjust them as they see fit. If template context changes over time with various releases it's again on the customizer to adjust their templates or stay pinned to an older version until they feel like doing it. It's not like anyone is going to be pushed too forcefully to update govr versions if what they have is working for them. Not a lot of security issues for example. This covers the use case of just wanting to customize a single template, or the CSS, or all of it. If I'd through the source correctly I believe all that needs to happen is:
Anything I may be missing? |
I think only templates() needs to honor the option. Defining a own directory and an explicit stylesheet doesn't make sense. Restructuring the templates to have several files for each part of a page and one file for the page structure and a option to specify other search directories for the templates would be the best. |
Hello!
We (REVSYS) have a client, a fellow Open Source project, that would like to use gcovr for their coverage reports. However, they would like to heavily adjust the styling to better suit their preferences and that of their project's website.
Would you all be open to a PR, if I did the work, to allow gcovr to support an
--html
output option but also honor a--template-dir
flag to point at a different set of jinja2 templates?The text was updated successfully, but these errors were encountered: