flake8-html icon indicating copy to clipboard operation
flake8-html copied to clipboard

#22 add option to generate one-page report

Open tmarenko opened this issue 2 years ago • 0 comments

Summary: https://github.com/lordmauve/flake8-html/issues/22

Approach:

  • added --self-contained-html option as a marker to understand whether need to write one or multiple HTML files

  • back.svg and file.svg files passes as Data URLs to one-page report

  • report and source HTML files will be in the same one-page report. Navigation is done in self-contained.js by hiding elements with page classes.

  • redesigned Jinja's templates:

  1. base.html is a base for every template (index, reports, sources)
  2. index.html now has additional logic based on self_contained marker
  3. file-report.html and annotated-source.html are used for usual reports without --self-contained-html option
  4. file-report-content.html and annotated-source-content.html are used both for usual and one-page report. Usual report uses them as template to fill, one-page report uses them to fill index.html template
  5. bind-handler.js contains JS script from file-report.html in order to reuse it in different template

tmarenko avatar Jun 15 '22 11:06 tmarenko