Skip to content

Commit adb7aab

Browse files
authored
Update footer to include both events pages (BlackPythonDevs#731)
* Update footer to include both events pages The main site has 2 events links: - BPD Events - Sponsored Events The update to the footer replaces the outdated `events` link and inserts the 2 new events links * Fix pre-commit errors * Add `pitch_deck` to the prettierignore file Prettier complains about the file because it has a closign div, but not an opening div. This is expected because this is a partial layout file, so it isn't opened here
1 parent 714e5fa commit adb7aab

File tree

5 files changed

+20
-29
lines changed

5 files changed

+20
-29
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ index.html
22
assets/js/jquery.min.js
33
assets/js/index.js
44
_layouts/*.html
5+
/_layouts/_includes/pitch_deck.html
56
_includes/conferences.html
67
_includes/header.html
78
_includes/social.html

_data/foundational_supporters.json

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
11
{
2-
"2025": [
3-
"Aman Singh",
4-
"Angela Andrews",
5-
"Carol Willing",
6-
"Hugh Dyar",
7-
"Jeremy Carbaugh",
8-
"Jonathan Banafato",
9-
"Mike Fiedler",
10-
"Ned Batchelder",
11-
"Peter Pinch",
12-
"Savannah Ostrowski",
13-
"Tim Schilling",
14-
"Vance Arocho"
15-
],
2+
"2025": ["Aman Singh", "Angela Andrews", "Carol Willing", "Hugh Dyar", "Jeremy Carbaugh", "Jonathan Banafato", "Mike Fiedler", "Ned Batchelder", "Peter Pinch", "Savannah Ostrowski", "Tim Schilling", "Vance Arocho"],
163
"2024": [
174
"Albert Sweigart",
185
"Angela Andrews",

_layouts/_includes/footer.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ <h3>About us</h3>
1111
<h3>Quick link</h3>
1212
<ul>
1313
<li><a href="/about.html">About Us</a></li>
14-
<li><a href="/events/">Events</a></li>
14+
<li><a href="/bdp-events/">Our Events</a></li>
15+
<li><a href="/sponsored-events/">Sponsored Events</a></li>
1516
<li><a href="/community/">Community</a></li>
1617
<li><a href="/support/">Support</a></li>
1718
</ul>

image_resize.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,59 +18,61 @@ def crop_to_ratio(img, target_ratio):
1818
top = (height - new_height) // 2
1919
return img.crop((0, top, width, top + new_height))
2020

21+
2122
def process_image(file_path, ratio, max_size, format="webp"):
2223
"""Process and overwrite the original image: crop, resize, convert format."""
2324
try:
2425
with Image.open(file_path) as img:
2526
# Crop to target ratio
2627
if ratio:
2728
img = crop_to_ratio(img, ratio)
28-
29+
2930
# Resize to max dimensions
3031
if max_size:
3132
img.thumbnail(max_size)
32-
33+
3334
# convert to webp if no transparency
3435
if format.lower() == "webp" and img.mode != "RGBA":
3536
file_path = os.path.splitext(file_path)[0] + ".webp"
3637
img.save(file_path, "webp", optimize=True, quality=85)
3738
else:
3839
img.save(file_path, optimize=True)
39-
40+
4041
print(f"✅ Overwritten: {file_path}")
4142
except Exception as e:
4243
print(f"❌ Failed {file_path}: {str(e)}")
4344

45+
4446
def main():
45-
folder = "assets/images"
46-
47+
folder = "assets/images"
48+
4749
# Rules for image types
4850
rules = [
4951
{
5052
"suffix": ["banner", "header"],
51-
"ratio": 16/9,
53+
"ratio": 16 / 9,
5254
"max_size": (1920, 1080), # Min size enforced via cropping
53-
"format": "webp"
55+
"format": "webp",
5456
},
5557
{
5658
"suffix": ["thumb", "profile"],
57-
"ratio": 1/1,
59+
"ratio": 1 / 1,
5860
"max_size": (800, 800),
59-
"format": "webp"
60-
}
61+
"format": "webp",
62+
},
6163
]
6264

6365
for filename in os.listdir(folder):
64-
if filename.lower().endswith(('.jpg', '.jpeg', '.png', '.webp')):
66+
if filename.lower().endswith((".jpg", ".jpeg", ".png", ".webp")):
6567
file_path = os.path.join(folder, filename)
66-
68+
6769
# Apply first rule
6870
matched_rule = None
6971
for rule in rules:
7072
if any(keyword in filename.lower() for keyword in rule["suffix"]):
7173
matched_rule = rule
7274
break
73-
75+
7476
# no cropping, resize to 800x600, convert to webp if no transparency
7577
if not matched_rule:
7678
with Image.open(file_path) as img:
@@ -79,5 +81,6 @@ def main():
7981

8082
process_image(file_path, **matched_rule)
8183

84+
8285
if __name__ == "__main__":
8386
main()

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ pytest-xprocess
1919
axe-core-python==0.1.0
2020
axe-playwright-python==0.1.4
2121
Pillow==11.2.1
22-

0 commit comments

Comments
 (0)