Output website template from postprocessor

This commit is contained in:
akp 2025-01-25 01:26:40 +00:00
parent 2acb7c7e3c
commit fb6081d4d6
No known key found for this signature in database
GPG key ID: CF8D58F3DEB20755

View file

@ -70,39 +70,32 @@ for row in raw_data_object["data"]:
for row in raw_data_object["notes"]:
notes_by_type[(row["chemistry"], row["format"], row["subformat"])] = row["note"]
acc = """---
title: "Film Development Price Comparison"
hideAside: true
asDirectory: false
---
{% extends "_layouts/base.html" %}
{% block head %}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/simple-datatables@latest/dist/style.css" />
<script src="https://cdn.jsdelivr.net/npm/simple-datatables@latest"></script>
<style>
nav.datatable-pagination {
all: unset !important;
}
</style>
{% endblock %}
{% block main %}
"""
doc, tag, text, line = Doc().ttl()
doc.asis("<!DOCTYPE html>")
with tag("html"):
with tag("head"):
line("title", "Film Development Price Comparison :: abi abi")
doc.stag("meta", charset="utf-8")
doc.stag("meta", name="viewport", content="width=device-width, initial-scale=1")
doc.stag(
"link",
rel="stylesheet",
href="https://www.akpain.net/assets/css/risotto.css",
)
doc.stag(
"link",
rel="stylesheet",
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css",
)
doc.stag(
"link",
rel="stylesheet",
href="https://cdn.jsdelivr.net/npm/simple-datatables@latest/dist/style.css",
)
with tag("script", src="https://cdn.jsdelivr.net/npm/simple-datatables@latest"):
doc.asis("")
with tag("body"):
with tag("div", klass="container pt-3"):
line("a", "[abi abi] $", klass="pe-3", href="https://www.akpain.net")
line("a", "back to photography", href="https://www.akpain.net/photography/")
line("a", "Back to photography", href="https://www.akpain.net/photography/")
line("h1", "Film Development Price Comparison", klass="pt-2")
line("h1", "Film Development Price Comparison")
line("p", "This is my attempt to work out the best value for money film developing and scanning service that's available in the UK. Labs are compared as like-for-like as possible, but some variation (especially in scan size) is inevitable.")
with tag("p"):
@ -124,10 +117,11 @@ with tag("html"):
text(".")
with tag("div", klass="card", style="width: 18rem;"):
with tag("div", klass="card-body"):
line("div", "Contents", klass="card-title", style="font-family: var(--font-monospace)")
with tag("ul", klass="card-text"):
with tag("div", klass="toc-container", style="width: 18rem;"):
with tag("div", klass="header"):
line("span", "On this page", klass="h4 font--monospace-bold")
with tag("div", klass="content"):
with tag("ul"):
for key in entries_by_type:
chemistry, format, subformat = key
slug = slugify(chemistry + format + subformat)
@ -145,7 +139,6 @@ with tag("html"):
line(
"h2",
f"{chemistry} {format} ({subformat})",
klass="h3 pt-4",
id=slug + "-title",
)
@ -247,5 +240,9 @@ with tag("html"):
):
doc.asis()
acc += doc.getvalue()
acc += """
{% endblock %}"""
with open(OUTPUTFILE, "w") as f:
f.write(doc.getvalue())
f.write(acc)