From 0d5ef74714e0f199a48e646e00eaed1fa7ef9bdb Mon Sep 17 00:00:00 2001 From: Quentin Fortier Date: Wed, 6 Jul 2022 15:22:13 +0200 Subject: [PATCH 1/8] Test --- src/sphinx_book_theme/header_buttons/launch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sphinx_book_theme/header_buttons/launch.py b/src/sphinx_book_theme/header_buttons/launch.py index c5b220b0d..761d53614 100644 --- a/src/sphinx_book_theme/header_buttons/launch.py +++ b/src/sphinx_book_theme/header_buttons/launch.py @@ -141,7 +141,7 @@ def add_launch_buttons( launch_buttons_list.append( { "type": "link", - "text": "Colab", + "text": "ColabTest", "tooltip": "Launch on Colab", "icon": "_static/images/logo_colab.png", "url": url, From 5ba5f4ec765d6f1c67284915ff16e8fc06f9c167 Mon Sep 17 00:00:00 2001 From: Quentin Fortier Date: Wed, 6 Jul 2022 18:16:51 +0200 Subject: [PATCH 2/8] Add basthon button --- .../header_buttons/launch.py | 14 ++++- .../static/images/basthon.svg | 62 +++++++++++++++++++ 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 src/sphinx_book_theme/theme/sphinx_book_theme/static/images/basthon.svg diff --git a/src/sphinx_book_theme/header_buttons/launch.py b/src/sphinx_book_theme/header_buttons/launch.py index 761d53614..29fb1635e 100644 --- a/src/sphinx_book_theme/header_buttons/launch.py +++ b/src/sphinx_book_theme/header_buttons/launch.py @@ -141,7 +141,7 @@ def add_launch_buttons( launch_buttons_list.append( { "type": "link", - "text": "ColabTest", + "text": "Colab", "tooltip": "Launch on Colab", "icon": "_static/images/logo_colab.png", "url": url, @@ -161,6 +161,18 @@ def add_launch_buttons( } ) + if basthon_url: + url = f"{basthon_url}/?from=https://raw.githubusercontent.com/{org}/{repo}/{branch}/{path_rel_repo}" + launch_buttons_list.append( + { + "type": "link", + "text": "Basthon", + "tooltip": "Launch on Basthon", + "icon": "_static/images/logo_colab.png", + "url": url, + } + ) + # Add thebe flag in context if launch_buttons.get("thebe", False): launch_buttons_list.append( diff --git a/src/sphinx_book_theme/theme/sphinx_book_theme/static/images/basthon.svg b/src/sphinx_book_theme/theme/sphinx_book_theme/static/images/basthon.svg new file mode 100644 index 000000000..2b2b9a50b --- /dev/null +++ b/src/sphinx_book_theme/theme/sphinx_book_theme/static/images/basthon.svg @@ -0,0 +1,62 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + From 89a23aaf93895256225625d5eacd84711218b68d Mon Sep 17 00:00:00 2001 From: Quentin Fortier Date: Wed, 6 Jul 2022 18:22:41 +0200 Subject: [PATCH 3/8] Add basthon url --- docs/conf.py | 1 + src/sphinx_book_theme/header_buttons/launch.py | 1 + tests/sites/base/conf.py | 1 + 3 files changed, 3 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index b9fd713f4..b60382edd 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -111,6 +111,7 @@ "binderhub_url": "https://mybinder.org", "colab_url": "https://colab.research.google.com/", "deepnote_url": "https://deepnote.com/", + "basthon_url": "https://notebook.basthon.fr/", "notebook_interface": "jupyterlab", "thebe": True, # "jupyterhub_url": "https://datahub.berkeley.edu", # For testing diff --git a/src/sphinx_book_theme/header_buttons/launch.py b/src/sphinx_book_theme/header_buttons/launch.py index 29fb1635e..65c31418b 100644 --- a/src/sphinx_book_theme/header_buttons/launch.py +++ b/src/sphinx_book_theme/header_buttons/launch.py @@ -102,6 +102,7 @@ def add_launch_buttons( jupyterhub_url = launch_buttons.get("jupyterhub_url", "").strip("/") binderhub_url = launch_buttons.get("binderhub_url", "").strip("/") colab_url = launch_buttons.get("colab_url", "").strip("/") + basthon_url = launch_buttons.get("basthon_url", "").strip("/") deepnote_url = launch_buttons.get("deepnote_url", "").strip("/") if binderhub_url: url = ( diff --git a/tests/sites/base/conf.py b/tests/sites/base/conf.py index c778039b4..9f628a720 100644 --- a/tests/sites/base/conf.py +++ b/tests/sites/base/conf.py @@ -27,6 +27,7 @@ "jupyterhub_url": "https://datahub.berkeley.edu", "colab_url": "https://colab.research.google.com", "deepnote_url": "https://deepnote.com", + "basthon_url": "https://notebook.basthon.fr", "notebook_interface": "jupyterlab", "thebe": True, }, From e0e800a2df97a14f096717da72b79f2bbec9dfaa Mon Sep 17 00:00:00 2001 From: Quentin Fortier Date: Wed, 6 Jul 2022 18:27:21 +0200 Subject: [PATCH 4/8] Add logo basthon --- src/sphinx_book_theme/header_buttons/launch.py | 2 +- .../static/images/{basthon.svg => logo_basthon.svg} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/sphinx_book_theme/theme/sphinx_book_theme/static/images/{basthon.svg => logo_basthon.svg} (100%) diff --git a/src/sphinx_book_theme/header_buttons/launch.py b/src/sphinx_book_theme/header_buttons/launch.py index 65c31418b..68f78dba0 100644 --- a/src/sphinx_book_theme/header_buttons/launch.py +++ b/src/sphinx_book_theme/header_buttons/launch.py @@ -169,7 +169,7 @@ def add_launch_buttons( "type": "link", "text": "Basthon", "tooltip": "Launch on Basthon", - "icon": "_static/images/logo_colab.png", + "icon": "_static/images/logo_basthon.svg", "url": url, } ) diff --git a/src/sphinx_book_theme/theme/sphinx_book_theme/static/images/basthon.svg b/src/sphinx_book_theme/theme/sphinx_book_theme/static/images/logo_basthon.svg similarity index 100% rename from src/sphinx_book_theme/theme/sphinx_book_theme/static/images/basthon.svg rename to src/sphinx_book_theme/theme/sphinx_book_theme/static/images/logo_basthon.svg From 1d41b312109d5e5a8ac8b9eacf2373a1daf3ba55 Mon Sep 17 00:00:00 2001 From: Quentin Fortier Date: Thu, 7 Jul 2022 16:59:19 +0000 Subject: [PATCH 5/8] Update tests for basthon --- tests/test_build/build__header-article.html | 10 ++++++++++ tests/test_build/test_header_launchbtns.html | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/tests/test_build/build__header-article.html b/tests/test_build/build__header-article.html index 74bc3326b..b7a6fc73d 100644 --- a/tests/test_build/build__header-article.html +++ b/tests/test_build/build__header-article.html @@ -56,6 +56,16 @@ +
  • + + + + + + Basthon + + +
  • +
  • + + + + + + Basthon + + +
  • +
  • + + + + + + Basthon + + +
  • +
  • + + + + + + Basthon + + +