some styling

This commit is contained in:
Nick Pegg 2024-08-03 18:55:44 -07:00
parent 321cbee134
commit 085c1dee88
4 changed files with 39 additions and 2 deletions

View file

@ -156,10 +156,15 @@ def generate_html(config: Config, root_dir: ImageDirectory) -> None:
for album_dir in root_dir.walk():
html_path = album_dir.path / "index.html"
static_path = root_dir.path.relative_to(
html_path.parent, walk_up=True
) / "static"
logger.debug(f"Rendering {html_path}")
with html_path.open("w") as f:
f.write(
album_tmpl.render(
static_dir=static_path,
album_dir=album_dir,
)
)
@ -168,11 +173,16 @@ def generate_html(config: Config, root_dir: ImageDirectory) -> None:
# TODO: If a file with a matching name but .txt or .md, add that as the
# description for the image
html_path = image_path.html_path()
static_path = root_dir.path.relative_to(
html_path.parent, walk_up=True
) / "static"
html_path.parent.mkdir(exist_ok=True)
logger.debug(f"Rendering {html_path}")
with html_path.open("w") as f:
f.write(
photo_tmpl.render(
static_dir=static_path,
image_path=image_path,
)
)