-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathutils.py
22 lines (19 loc) · 933 Bytes
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from IPython.display import display, Markdown
def build_buttons(link, github, colab = True, citation=False):
"""
Used to generate github, collab, and website-linked buttons
"""
if citation:
citation_str = f'<a type="button" class="btn btn-outline-primary btn-sm" target="_self" href="#citation">🏛 Citation</a>'
else:
citation_str = ''
if colab:
colab_str = f'\n<a type="button" class="btn btn-outline-primary btn-sm" target="_blank" href="https://colab.research.google.com/github/{github.split(".com/")[-1]}">🖥️ Interactive version</a>'
else:
colab_str = ''
display(Markdown(f"""
<a type="button" class="btn btn-outline-primary btn-sm" target="_blank" href="https://inspectelement.org/{link}">📖 Read online</a>{colab_str}
<a type="button" class="btn btn-outline-primary btn-sm" target="_blank" href="{github}">⚙️ GitHub</a>
{citation_str}
<br>
"""))