Browse Source

Fix some mistakes in generation of galleries

master
Marien Fressinaud 6 years ago
parent
commit
69a9fa4e38
2 changed files with 5 additions and 4 deletions
  1. 1
    1
      Herisson/index.html.j2
  2. 4
    3
      boop.py

+ 1
- 1
Herisson/index.html.j2 View File

<div class="galleries"> <div class="galleries">
{% for gallery in galleries -%} {% for gallery in galleries -%}
<div class="gallery-cover"> <div class="gallery-cover">
<a href="{{ gallery.url }}.html">
<a href="{{ gallery.url }}">
<img src="{{ gallery.cover_photo.thumb_url }}" alt="" /> <img src="{{ gallery.cover_photo.thumb_url }}" alt="" />
<span class="gallery-cover-name"> <span class="gallery-cover-name">
{{ gallery.name }} {{ gallery.name }}

+ 4
- 3
boop.py View File

gallery = { gallery = {
"name": gallery_dir.name, "name": gallery_dir.name,
"path": gallery_dir.path, "path": gallery_dir.path,
"url": gallery_dir.name,
"output_path": gallery_dir.name,
"url": f"{gallery_dir.name}.html",
"num_photos": len(photos), "num_photos": len(photos),
"photos": photos, "photos": photos,
"cover_photo": photos[cover_index], "cover_photo": photos[cover_index],




def generate_gallery_index(output_path, gallery): def generate_gallery_index(output_path, gallery):
gallery_index_path = os.path.join(output_path, f"{gallery['name']}.html")
gallery_index_path = os.path.join(output_path, f"{gallery['url']}")


theme_path = os.path.join(os.curdir, THEME) theme_path = os.path.join(os.curdir, THEME)
jinja_env = Environment( jinja_env = Environment(




def generate_gallery_dir(output_path, gallery): def generate_gallery_dir(output_path, gallery):
gallery_output_path = os.path.join(output_path, gallery["name"])
gallery_output_path = os.path.join(output_path, gallery["output_path"])
if not os.path.isdir(gallery_output_path): if not os.path.isdir(gallery_output_path):
os.mkdir(gallery_output_path) os.mkdir(gallery_output_path)



Loading…
Cancel
Save