git ssb

0+

Grey the earthling / gkn.me.uk



Commit 30c0128a864b5c20c2b5f87e29a40f0c8e230a06

Always show a related entry's series

Grey Nicholson committed on 10/3/2021, 1:09:25 PM
Parent: 6274ace7f16374fb0f42a3689ff0dbef1a839241

Files changed

generator/common.pychanged
generator/templates/entry.pychanged
generator/common.pyView
@@ -137,8 +137,13 @@
137137 if "modified" in entries[id]
138138 else ""
139139 )
140140 + (
141 + " · " + "<b>" + entries[id]["series"] + "</b>"
142 + if "series" in entries[id]
143 + else ""
144 + )
145 + + (
141146 " · " + ", ".join("<b>" + label + "</b>" for label in kwargs["labels"])
142147 if "labels" in kwargs
143148 else ""
144149 )
generator/templates/entry.pyView
@@ -21,21 +21,14 @@
2121 if "series" in common.entries[id] and "series" in common.entries[other_entry]:
2222 if common.slugify(common.entries[id]["series"]) == common.slugify(
2323 common.entries[other_entry]["series"]
2424 ):
25- entries_in_this_series = common.entries_in_series(
26- common.entries[id]["series"]
27- )
28- if other_entry == common.offset_id(entries_in_this_series, id, -1):
25 + if other_entry == common.offset_id(
26 + common.entries_in_series(common.entries[id]["series"]), id, -1
27 + ):
2928 relevant_earlier_entries[
3029 other_entry
3130 ] = relevant_earlier_entries.get(other_entry, {})
32- relevant_earlier_entries[other_entry][
33- "labels"
34- ] = relevant_earlier_entries[other_entry].get("labels", [])
35- relevant_earlier_entries[other_entry]["labels"] += [
36- common.entries[id]["series"]
37- ]
3831 relevant_earlier_entries[other_entry].update({"rel": "prev"})
3932 if "tags" in common.entries[id] and "tags" in common.entries[other_entry]:
4033 for tag_string in [
4134 tag_string
@@ -50,17 +43,8 @@
5043 ] = relevant_earlier_entries.get(other_entry, {})
5144 relevant_earlier_entries[other_entry][
5245 "labels"
5346 ] = relevant_earlier_entries[other_entry].get("labels", [])
54- if (
55- "series" in common.entries[id]
56- and "series" in common.entries[other_entry]
57- and common.slugify(common.entries[id]["series"])
58- == common.slugify(common.entries[other_entry]["series"])
59- ):
60- relevant_earlier_entries[other_entry]["labels"] += [
61- common.entries[id]["series"]
62- ]
6347 relevant_earlier_entries[other_entry]["labels"] += [tag_string]
6448 relevant_earlier_entries[other_entry].update({"rel": "prev"})
6549 for other_entry in later_entries:
6650 if later_entries.index(other_entry) == 0:
@@ -71,21 +55,14 @@
7155 if "series" in common.entries[id] and "series" in common.entries[other_entry]:
7256 if common.slugify(common.entries[id]["series"]) == common.slugify(
7357 common.entries[other_entry]["series"]
7458 ):
75- entries_in_this_series = common.entries_in_series(
76- common.entries[id]["series"]
77- )
78- if other_entry == common.offset_id(entries_in_this_series, id, +1):
59 + if other_entry == common.offset_id(
60 + common.entries_in_series(common.entries[id]["series"]), id, +1
61 + ):
7962 relevant_later_entries[other_entry] = relevant_later_entries.get(
8063 other_entry, {}
8164 )
82- relevant_later_entries[other_entry][
83- "labels"
84- ] = relevant_later_entries[other_entry].get("labels", [])
85- relevant_later_entries[other_entry]["labels"] += [
86- common.entries[id]["series"]
87- ]
8865 relevant_later_entries[other_entry].update({"rel": "next"})
8966 if "tags" in common.entries[id] and "tags" in common.entries[other_entry]:
9067 for tag_string in [
9168 tag_string
@@ -100,17 +77,8 @@
10077 )
10178 relevant_later_entries[other_entry][
10279 "labels"
10380 ] = relevant_later_entries[other_entry].get("labels", [])
104- if (
105- "series" in common.entries[id]
106- and "series" in common.entries[other_entry]
107- and common.slugify(common.entries[id]["series"])
108- == common.slugify(common.entries[other_entry]["series"])
109- ):
110- relevant_later_entries[other_entry]["labels"] += [
111- common.entries[id]["series"]
112- ]
11381 relevant_later_entries[other_entry]["labels"] += [tag_string]
11482 relevant_later_entries[other_entry].update({"rel": "next"})
11583 links = ""
11684 if len(relevant_earlier_entries) > 0:

Built with git-ssb-web