-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsoftware.qmd
More file actions
73 lines (58 loc) · 1.84 KB
/
software.qmd
File metadata and controls
73 lines (58 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
title: "Software"
echo: false
jupyter: python3
section-divs: false
keep-md: false
execute:
include: true
sidebar: false
freeze: auto
keep-ipynb: true
---
```{python}
# | label: "software"
# | id: "software"
# | output: asis
import yaml
from IPython.display import display, Markdown, HTML
def button(url, str, icon):
icon_base = icon[:2]
return f"""<a class="btn btn-outline-dark btn-sm", href="{url}" target="_blank" rel="noopener noreferrer">
<i class="{icon_base} {icon}" role='img' aria-label='{str}'></i>
{str}
</a>"""
yaml_data = yaml.safe_load(open("software.yaml"))
def downloads_badge(package_name: str) -> str:
return f""""""
def pypi_v_badge(package_name: str) -> str:
return f""""""
for data in yaml_data[::1]:
logo_scale = data.get("logo_scale", 1)
width = 200 * logo_scale
display(Markdown("## `" + data["title"] + "` {#" + data["title"][0] + "}"))
if "logo" in data:
display(
HTML(
f"<img src={data['logo']} href='{data['website']}' align='right' alt='' width='{width}'>"
)
)
display(Markdown(data["description"]))
if "package" in data:
package_name = data["package"].split("/")[-2]
display(
Markdown(
downloads_badge(package_name)
+ " "
+ pypi_v_badge(package_name)
)
)
buttons = []
if "website" in data:
buttons.append(button(data["website"], "Website", "bi-info"))
if "github" in data:
buttons.append(button(data["github"], "Github", "bi-github"))
if "package" in data:
buttons.append(button(data["package"], "Package", "bi-box-seam"))
display(HTML(" ".join(buttons)))
```