File tree Expand file tree Collapse file tree 1 file changed +31
-3
lines changed
Expand file tree Collapse file tree 1 file changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -29,17 +29,45 @@ def fetch_yaml(url: str):
2929
3030
3131def 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 ,
You can’t perform that action at this time.
0 commit comments