summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-05-06 18:40:53 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-05-06 18:40:53 +0200
commit435dd18865ac0137d5ec7aa011555773eefb49c1 (patch)
tree4e1387c11e75ba975f550a7113fc1664c0395384
parent100b5a27923143a967edea96f70e35bb22d76a54 (diff)
--group-files: add links to other files
-rwxr-xr-xbin/pyggle23
-rw-r--r--share/css/dark.css4
-rw-r--r--share/css/light.css4
-rw-r--r--share/css/main.css11
4 files changed, 40 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,
)
diff --git a/share/css/dark.css b/share/css/dark.css
index e018ca4..2dadebe 100644
--- a/share/css/dark.css
+++ b/share/css/dark.css
@@ -8,6 +8,10 @@ a {
}
h1 {
+ color: #999999;
+}
+
+.nav a {
color: #cccccc;
}
diff --git a/share/css/light.css b/share/css/light.css
index 9d7ab32..b1a5170 100644
--- a/share/css/light.css
+++ b/share/css/light.css
@@ -3,6 +3,10 @@ a {
}
h1 {
+ color: #666666;
+}
+
+.nav a {
color: #333333;
}
diff --git a/share/css/main.css b/share/css/main.css
index 3931a65..f5def44 100644
--- a/share/css/main.css
+++ b/share/css/main.css
@@ -12,6 +12,17 @@ h1 {
margin-left: 1em;
}
+.nav a {
+ clear: both;
+ font-size: 200%;
+ padding-left: 1em;
+ padding-right: 1em;
+}
+
+.nav a.this-file {
+ font-weight: bold;
+}
+
div.image-container {
text-align: center;
float: left;