summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/pyggle23
1 files changed, 21 insertions, 2 deletions
diff --git a/bin/pyggle b/bin/pyggle
index 74d9d71..1b935e4 100755
--- a/bin/pyggle
+++ b/bin/pyggle
@@ -571,15 +571,32 @@ def copy_files(base_dir):
f.write(main_css)
-def write_gallery(file_buf, filename, thumbnails, group=None):
- prev_heading = None
+def write_gallery(
+ file_buf, filename, thumbnails, group=None, files=list(), this_file=None
+):
+
+ if files:
+ nav_buf = '<div class="nav">'
+ for link_target in files:
+ link_class = ""
+ if link_target == this_file:
+ link_class = "this-file"
+ nav_buf += (
+ f'<a class="{link_class}" href="{link_target}.html">{link_target}</a>\n'
+ )
+ nav_buf += "</div>"
+ file_buf += nav_buf
+ prev_heading = None
for i, thumbnail in enumerate(thumbnails):
if group and thumbnail.group_key != prev_heading:
file_buf += f"<h1>{thumbnail.group_key}</h1>"
prev_heading = thumbnail.group_key
file_buf += thumbnail.to_html(i, args.with_detail_page)
+ if files:
+ file_buf += nav_buf
+
with open(f"{base_dir}/share/html_end", "r") as f:
file_buf += f.read()
@@ -799,4 +816,6 @@ if __name__ == "__main__":
f"{thumbnail_key}.html",
list(filter(lambda t: t.file_key == thumbnail_key, thumbnails)),
group=args.group,
+ files=thumbnail_keys,
+ this_file=thumbnail_key,
)