Skip to content

hertzforge.report.page

page

The HTML page, stylesheet and viewers a report carries.

All of it is written here, with nothing loaded from a CDN or embedded from a third party, so the file opens on a locked-down machine with no network and contains no code from anyone else. The scene viewer uses the desktop animator's phase arithmetic on an orthographic canvas; the plot viewer is a line plot that zooms with the wheel, pans by dragging, and has decade ticks on log axes.

The same viewers also go out as a script of their own, the figure renderer (renderer_js), for a host page that mounts a figure on an element of its own and loads its data as a JSON file.

Functions:

Name Description
scoped_css

css with every rule confined to the elements under scope.

renderer_js

The figure renderer's text: one script for every figure of

page_parts

(CSS, JS) for a report page with features enabled.

Functions:

scoped_css

scoped_css(css: str, scope: str = FIGURE_SCOPE) -> str

css with every rule confined to the elements under scope.

The page's stylesheet styles a whole document: :root holds its colors, body its font and html.fill the one-figure layout. Under a scope those become the scope element itself, .fill a class on it, and every other selector a descendant of it. @media blocks are scoped inside. Any other at-rule, or a selector reaching above the body, is refused: a rule this cannot place would style the host page.

renderer_js

renderer_js(version: str) -> str

The figure renderer's text: one script for every figure of format FIGURE_FORMAT, marked with the package version that wrote it.

page_parts

page_parts(features: Iterable[str] = ()) -> tuple[str, str]

(CSS, JS) for a report page with features enabled.

With no feature that adds page code, _CSS and _JS themselves, untouched. Otherwise each such feature's splices are made in _JS, its functions added after it and its CSS after _CSS. Raises RuntimeError when an anchor is not in _JS exactly once.