Skip to content

json

json

HTML document based report renderer.

JSONRenderer

Bases: Renderer

Renderer implementation outputting HTML files content.

Source code in cssfinder/reports/json.py
class JSONRenderer(Renderer):
    """Renderer implementation outputting HTML files content."""

    def render(self) -> Report:
        """Generate report content."""
        return Report(
            json.dumps(
                {
                    "title": self.ctx.title,
                    "meta": self.ctx.meta,
                    "math": self.ctx.math_props,
                },
                indent=4,
            ).encode("utf-8"),
            ReportType.JSON,
            self.ctx.task.task_output_directory / "report.json",
        )

render

render() -> Report

Generate report content.

Source code in cssfinder/reports/json.py
def render(self) -> Report:
    """Generate report content."""
    return Report(
        json.dumps(
            {
                "title": self.ctx.title,
                "meta": self.ctx.meta,
                "math": self.ctx.math_props,
            },
            indent=4,
        ).encode("utf-8"),
        ReportType.JSON,
        self.ctx.task.task_output_directory / "report.json",
    )