Skip to content

Commit fe03731

Browse files
committed
infrastructure working locally!
1 parent df6a12b commit fe03731

File tree

6 files changed

+102
-17
lines changed

6 files changed

+102
-17
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,7 @@ resource-gallery-submission-input.json
143143
.github/workflows/analytics-api/
144144
portal/metrics/*.png
145145
cisl-vast-pythia-*.json
146+
147+
# Blog post generation
148+
portal/atom.xml
149+
portal/rss.xml

portal/posts/2023/cookoff2023.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ During the hackthon, significant additions were made to our Radar Cookbook and i
1616

1717
From our post-hackathon exit survey, everyone enjoyed the event, felt that they learned new skills and that their contributions were valued. One scientist commented, “The hackathon for me has become a great place to get a sense of a community. Seeing people enthusiastic about coding up notebooks that would benefit the research community is a gateway for someone starting to code in Python.” This comment mirrors the efforts of Project Pythia as a community-owned resource.
1818

19-
<img src="../_static/images/posts/projectpythia-cookbook-cookoff.jpeg" alt="Cookoff Image">
19+
<img src="../../_static/images/posts/projectpythia-cookbook-cookoff.jpeg" alt="Cookoff Image">

portal/posts/2025/new-cookbooks.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,11 @@ This Cookbook covers how to work with wavelets in Python. Wavelets are a powerfu
173173

174174
### In pictures
175175

176-
<img src="../_static/images/posts/IMG_5686.jpeg" alt="2024 Cookoff group photo" width=900>
176+
<img src="../../_static/images/posts/IMG_5686.jpeg" alt="2024 Cookoff group photo" width=900>
177177
<br>
178-
<img src="../_static/images/posts/IMG_5854.jpeg" alt="Breakout group" width=250>
179-
<img src="../_static/images/posts/IMG_6546.jpg" alt="Cookoff attendees at Mesa Lab" width=250>
180-
<img src="../_static/images/posts/IMG_6055.jpeg" alt="Virtual presentation" width=250>
178+
<img src="../../_static/images/posts/IMG_5854.jpeg" alt="Breakout group" width=250>
179+
<img src="../../_static/images/posts/IMG_6546.jpg" alt="Cookoff attendees at Mesa Lab" width=250>
180+
<img src="../../_static/images/posts/IMG_6055.jpeg" alt="Virtual presentation" width=250>
181181

182182
### By the numbers
183183

portal/posts/blog.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Blog
22

3-
Below are a few of the latest posts in my blog.
4-
You can see a full list by year to the left.
3+
Below is the latest news from Project Pythia.
54

65
:::{postlist}
76
:number: 25

portal/src/blogpost.py

100644100755
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
import argparse
33
import json
44
import sys
@@ -45,6 +45,8 @@
4545
)
4646
N_WORDS = 50
4747
words = " ".join(content.split(" ")[:N_WORDS])
48+
if "author" not in meta:
49+
meta["author"] = "Project Pythia Team"
4850
meta["content"] = meta.get("description", words)
4951
posts.append(meta)
5052
posts = pd.DataFrame(posts)
@@ -56,20 +58,20 @@
5658
fg = FeedGenerator()
5759
fg.id("https://projectpythia.org/")
5860
fg.title("Project Pythia blog")
59-
fg.author({"name": "Project Pythia Team", "email": "[email protected]"})
61+
fg.author({"name": "Project Pytia Team", "email": "[email protected]"})
6062
fg.link(href="https://projectpythia.org/", rel="alternate")
61-
fg.logo("_static/images/logos/pythia_logo-blue-btext.svg")
62-
fg.subtitle("")
63-
fg.link(href="http://chrisholdgraf.com/rss.xml", rel="self")
63+
fg.logo("https://projectpythia.org/_static/profile.jpg")
64+
fg.subtitle("Project Pythia blog!")
65+
fg.link(href="https://projectpythia.org/", rel="self")
6466
fg.language("en")
6567

6668
# Add all my posts to it
6769
for ix, irow in posts.iterrows():
6870
fe = fg.add_entry()
69-
fe.id(f'https://projectpythia.org/{irow["path"]}')
71+
fe.id(f"https://projectpythia.org/{irow['path']}")
7072
fe.published(irow["date"])
7173
fe.title(irow["title"])
72-
fe.link(href=f'https://projectpythia.org/{irow["path"]}')
74+
fe.link(href=f"https://projectpythia.org/{irow['path']}")
7375
fe.content(content=irow["content"])
7476

7577
# Write an RSS feed with latest posts
@@ -99,17 +101,17 @@
99101
children.append(
100102
{
101103
"type": "card",
102-
"url": f'/{irow["path"].with_suffix("")}',
104+
"url": f"/{irow['path'].with_suffix('')}",
103105
"children": [
104106
{"type": "cardTitle", "children": [u.text(irow["title"])]},
105107
{"type": "paragraph", "children": [u.text(irow["content"])]},
106108
{
107109
"type": "footer",
108110
"children": [
109111
u.strong([u.text("Date: ")]),
110-
u.text(f'{irow["date"]:%B %d, %Y} | '),
112+
u.text(f"{irow['date']:%B %d, %Y} | "),
111113
u.strong([u.text("Author: ")]),
112-
u.text(f'{irow["author"]}'),
114+
u.text(f"{irow['author']}"),
113115
],
114116
},
115117
],

portal/src/unist.py

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
"""
2+
Copied from:
3+
https://github.com/projectpythia-mystmd/cookbook-gallery/blob/main/unist.py
4+
"""
5+
6+
7+
# Node Creation Tools
8+
def text(value, **opts):
9+
return {"type": "text", "value": value, **opts}
10+
11+
12+
def strong(children, **opts):
13+
return {"type": "strong", "children": children, **opts}
14+
15+
16+
def link(children, url, **opts):
17+
return {"type": "link", "url": url, "children": children, **opts}
18+
19+
20+
def table(children, **opts):
21+
return {"type": "table", "children": children, **opts}
22+
23+
24+
def table_cell(children, **opts):
25+
return {"type": "tableCell", "children": children, **opts}
26+
27+
28+
def table_row(cells, **opts):
29+
return {"type": "tableRow", "children": cells, **opts}
30+
31+
32+
def span(children, style, **opts):
33+
return {"type": "span", "children": children, "style": style, **opts}
34+
35+
36+
def definition_list(children, **opts):
37+
return {"type": "definitionList", "children": children, **opts}
38+
39+
40+
def definition_term(children, **opts):
41+
return {"type": "definitionTerm", "children": children, **opts}
42+
43+
44+
def definition_description(children, **opts):
45+
return {"type": "definitionDescription", "children": children, **opts}
46+
47+
48+
def list_(children, ordered=False, spread=False, **opts):
49+
return {
50+
"type": "list",
51+
"ordered": ordered,
52+
"spread": spread,
53+
"children": children,
54+
**opts,
55+
}
56+
57+
58+
def list_item(children, spread=True, **opts):
59+
return {"type": "listItem", "spread": spread, "children": children, **opts}
60+
61+
62+
def image(url, **opts):
63+
return {"type": "image", "url": url, **opts}
64+
65+
66+
def grid(columns, children, **opts):
67+
return {"type": "grid", "columns": columns, "children": children, **opts}
68+
69+
70+
def div(children, **opts):
71+
return {"type": "div", "children": children, **opts}
72+
73+
74+
def find_all_by_type(parent: dict, type_: str):
75+
for node in parent["children"]:
76+
if node["type"] == type_:
77+
yield node
78+
if "children" not in node:
79+
continue
80+
yield from find_all_by_type(node, type_)

0 commit comments

Comments
 (0)