Skip to content

Commit

Permalink
Fix link to download notebook badge in documentation (#1801)
Browse files Browse the repository at this point in the history
* Add random change

* Fix download links

* Update link and rename variables

* Update introduction file with new links
  • Loading branch information
bennibolm authored Jan 11, 2024
1 parent 994bb4b commit 08ae0f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions docs/literate/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ function create_files(title, file, repo_src, pages_dir, notebooks_dir; folder=""
end

binder_logo = "https://mybinder.org/badge_logo.svg"
nbviewer_logo = "https://raw.githubusercontent.com/jupyter/design/master/logos/Badges/nbviewer_badge.svg"
download_logo = "https://camo.githubusercontent.com/aea75103f6d9f690a19cb0e17c06f984ab0f472d9e6fe4eadaa0cc438ba88ada/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f776e6c6f61642d6e6f7465626f6f6b2d627269676874677265656e"
nbviewer_logo = "https://img.shields.io/badge/render-nbviewer-f37726"
raw_notebook_logo = "https://img.shields.io/badge/raw-notebook-4cc61e"

notebook_path = "tutorials/notebooks/$notebook_filename"
binder_url = "https://mybinder.org/v2/gh/trixi-framework/Trixi.jl/tutorial_notebooks?filepath=$notebook_path"
nbviewer_url = "https://nbviewer.jupyter.org/github/trixi-framework/Trixi.jl/blob/tutorial_notebooks/$notebook_path"
download_url = "https://raw.githubusercontent.com/trixi-framework/Trixi.jl/tutorial_notebooks/$notebook_path"
raw_notebook_url = "https://raw.githubusercontent.com/trixi-framework/Trixi.jl/tutorial_notebooks/$notebook_path"

binder_badge = "# [![]($binder_logo)]($binder_url)"
nbviewer_badge = "# [![]($nbviewer_logo)]($nbviewer_url)"
download_badge = "# [![]($download_logo)]($download_url)"
raw_notebook_badge = "# [![]($raw_notebook_logo)]($raw_notebook_url)"

# Generate notebook file
function preprocess_notebook(content)
Expand All @@ -32,7 +32,7 @@ function create_files(title, file, repo_src, pages_dir, notebooks_dir; folder=""

# Generate markdown file
function preprocess_docs(content)
return string("# # [$title](@id $(splitext(file)[1]))\n $binder_badge\n $nbviewer_badge\n $download_badge\n\n", content)
return string("# # [$title](@id $(splitext(file)[1]))\n $binder_badge\n $nbviewer_badge\n $raw_notebook_badge\n\n", content)
end
Literate.markdown(joinpath(repo_src, folder, file), joinpath(pages_dir, folder); preprocess=preprocess_docs,)
end
Expand Down
4 changes: 2 additions & 2 deletions docs/literate/src/files/index.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

# Right now, you are using the classic documentation. The corresponding interactive notebooks can
# be opened in [Binder](https://mybinder.org/) and viewed in [nbviewer](https://nbviewer.jupyter.org/)
# via the icons ![](https://mybinder.org/badge_logo.svg) and ![](https://raw.githubusercontent.com/jupyter/design/master/logos/Badges/nbviewer_badge.svg)
# via the icons ![](https://mybinder.org/badge_logo.svg) and ![](https://img.shields.io/badge/render-nbviewer-f37726)
# in the respective tutorial.
# You can download the raw notebooks from GitHub via ![](https://camo.githubusercontent.com/aea75103f6d9f690a19cb0e17c06f984ab0f472d9e6fe4eadaa0cc438ba88ada/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f776e6c6f61642d6e6f7465626f6f6b2d627269676874677265656e).
# You can also open the raw notebook files via ![](https://img.shields.io/badge/raw-notebook-4cc61e).

# **Note:** To improve responsiveness via caching, the notebooks are updated only once a week. They are only
# available for the latest stable release of Trixi.jl at the time of caching.
Expand Down

0 comments on commit 08ae0f2

Please sign in to comment.