-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tutorials: add Open in Studio badge (#2146)
* Tutorials: add Open in Studio badge * Keep CSS name the same * Remove custom CSS * Revert "Remove custom CSS" This reverts commit 85c3159. * Single badge (to prove a point) * Revert "Single badge (to prove a point)" This reverts commit e9d781f. * Move jinja code to separate file
- Loading branch information
1 parent
bc70466
commit 87f866d
Showing
4 changed files
with
39 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* https://github.com/pytorch/pytorch_sphinx_theme/issues/140 */ | ||
.tutorial-badge { | ||
height: 50px !important; | ||
width: auto !important; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{# Macros #} | ||
{% macro image(badge, class, alt, target) %} | ||
.. image:: {{ badge }} | ||
:class: {{ class }} | ||
:alt: {{ alt }} | ||
:target: {{ target }} | ||
{% endmacro %} | ||
|
||
{# Global variables #} | ||
{% if "dev" in env.config.release %} | ||
{% set branch = "main" %} | ||
{% else %} | ||
{% set branch = "releases/v" ~ env.config.version %} | ||
{% endif %} | ||
{% set class = "tutorial-badge" %} | ||
{% set path = "/microsoft/torchgeo/blob/" ~ branch ~ "/docs/" ~ env.docname ~ ".ipynb" %} | ||
|
||
{# Lightning Studio #} | ||
{% set badge = "https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/studio-badge.svg" %} | ||
{% set alt = "Open in Studio" %} | ||
{% set repo_url = "https://github.com" ~ path %} | ||
{% set target = "https://lightning.ai/new?repo_url=" ~ repo_url | urlencode %} | ||
|
||
{{ image(badge, class, alt, target) }} | ||
|
||
{# Google Colab #} | ||
{% set badge = "https://colab.research.google.com/assets/colab-badge.svg" %} | ||
{% set alt = "Open in Colab" %} | ||
{% set target = "https://colab.research.google.com/github" ~ path %} | ||
|
||
{{ image(badge, class, alt, target) }} |