Skip to content

Commit 19e5b93

Browse files
committed
resource gallery works
1 parent ac7ac63 commit 19e5b93

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

pythia-gallery.py

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,45 @@ def fetch_yaml(url: str):
2929

3030

3131
def render_resource(resource: dict):
32-
return {}
33-
34-
def new_render_resource(resource: dict):
3532

3633
title = resource["title"]
3734
resource_url = resource["url"]
3835
description = resource["description"]
3936

37+
38+
#if "thumbnail" in resource:
39+
#else:
40+
try:
41+
thumbnail = "https://projectpythia.org/" + resource['thumbnail']
42+
except:
43+
thumbnail = "https://projectpythia.org/_static/thumbnails/ProjectPythia_Blue.png"
44+
4045
# Build tags
4146
tags = resource["tags"]
4247

48+
return {
49+
"type": "card",
50+
"url": resource_url,
51+
"children": [
52+
{"type": "cardTitle", "children": [text(title)]},
53+
div([
54+
image(thumbnail),
55+
text(description),
56+
div(
57+
[
58+
span(
59+
[text(item)],
60+
style=styles.get(name, DEFAULT_STYLE),
61+
)
62+
for name, items in tags.items()
63+
if items is not None
64+
for item in items
65+
]
66+
)
67+
])
68+
]
69+
}
70+
4371
return {
4472
"type": "card",
4573
"url": resource_url,

0 commit comments

Comments
 (0)