{# Adapted from https://github.com/pradyunsg/furo/blob/main/src/furo/theme/furo/components/view-this-page.html Required to properly link the view button in the examples from the doc to source document in the github repo, and to hide it for autosummary-generated API reference pages that have no rst source committed to the repo. #} {% extends "basic-ng/components/view-this-page.html" %} {% from "basic-ng/components/view-this-page.html" import determine_page_view_link with context %} {%- macro furo_view_button(url) -%} {%- if 'doc/auto_examples' in url -%} {% set url = url|replace("doc/auto_examples", "examples")|replace(".rst", ".py")|replace("index.py", "README.rst")|replace("?plain=true", "") %} {%- endif -%}
{%- endmacro -%} {% block link_available -%} {%- if not pagename.startswith("modules/generated/") -%} {{ furo_view_button(determine_page_view_link() ) }} {%- endif -%} {%- endblock link_available %} {% block link_not_available %} {# Make nice things happen, on Read the Docs #} {%- if not pagename.startswith("modules/generated/") and READTHEDOCS and conf_py_path and page_source_suffix and github_user != "None" and github_repo != "None" and github_version and pagename and page_source_suffix %} {% set url = "https://github.com/" + github_user + "/" + github_repo + "/blob/" + github_version + conf_py_path + pagename + page_source_suffix + "?plain=true" %} {{ furo_view_button(url) }} {%- endif -%} {% endblock link_not_available %}