From 1fcc04b7856c0a44f4298d2303bc1f3c58a67523 Mon Sep 17 00:00:00 2001 From: Max Value Date: Fri, 6 Jun 2025 14:11:13 +0100 Subject: [PATCH] Styling changes + dark mode rules + print rules + print prompt on page + sous regex to make hex codes show up as colors --- sous.py | 7 +++++++ style.css | 25 +++++++++++++++++++++++++ templates/template.html | 5 ++++- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/sous.py b/sous.py index 37f8df9..fdef8a7 100755 --- a/sous.py +++ b/sous.py @@ -5,6 +5,7 @@ from os import path, listdir, system from jinja2 import Environment, FileSystemLoader from datetime import datetime from tqdm import tqdm +import re class RecipeBook: def __init__(self): @@ -81,6 +82,12 @@ class Recipe: def render_html(self, environment: Environment): template = environment.get_template("template.html") + self.recipe['information']['notes'] = re.sub( + r"(?P#[\da-fA-F]{6})", + r"\g", + self.recipe['information']['notes'] + ) + with open(path.join("recipes", self.recipe["html"]), "w") as f: f.write(template.render(recipe = self.recipe, time = datetime.now())) diff --git a/style.css b/style.css index ad93b48..4f6c9e9 100644 --- a/style.css +++ b/style.css @@ -15,9 +15,34 @@ th { img { width: 100%; } +p { + text-align: justify; +} p + p { text-indent: 1.5em; } dt { font-weight: bold; } + +@media (prefers-color-scheme: dark) { + body { + color: gray; + background-color: black; + } +} + +@media print { + body { + font-size: 12px; + } + main { + width: 100%; + } + nav, a, p:last-of-type { + display: none; + } + p:first-of-type:after { + content: " Printed from https://bread.ozva.co.uk."; + } +} diff --git a/templates/template.html b/templates/template.html index 064336a..7201155 100644 --- a/templates/template.html +++ b/templates/template.html @@ -9,8 +9,11 @@
Back to main page

{{ recipe.information.title }}

+

{{ recipe.information.description }}

Notes

-- 2.39.2