$def with (project, filename, content, test_coverage) $ prefix, _, name = filename.rpartition("/") $if prefix: $ file_tree = chain(*[(p, f"{p}") for p in prefix.split("/")]) $else: $ file_tree = [] $ breadcrumbs = ("projects", "Projects", project, f"{project}") $if filename: $ breadcrumbs += ("files", "Files") + tuple(file_tree) $var breadcrumbs = breadcrumbs $var title = name $if content is None: $elif isinstance(content, str):
$:highlight(content, name, coverage=test_coverage) $else: $if filename: $ filename = f"/{filename}"