From 509c558905cb5127402fdbb9d36166eb34fc1ef2 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Thu, 29 Sep 2022 22:57:12 +0100 Subject: [PATCH] Modernise the `edit-this-page.html` template This now uses the current `basic-ng` template for determining when and how to present the edit button. --- .../theme/furo/components/edit-this-page.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/furo/theme/furo/components/edit-this-page.html b/src/furo/theme/furo/components/edit-this-page.html index 6945488d3..5670cbe8d 100644 --- a/src/furo/theme/furo/components/edit-this-page.html +++ b/src/furo/theme/furo/components/edit-this-page.html @@ -1,3 +1,4 @@ +{% extends "basic-ng/components/edit-this-page.html" %} {% from "basic-ng/components/edit-this-page.html" import determine_page_edit_link with context %} {%- macro furo_edit_button(url) -%} @@ -13,15 +14,14 @@ {%- endmacro -%} +{% block link_available -%} +{{ furo_edit_button(determine_page_edit_link()) }} +{%- endblock %} -{%- if theme_source_repository -%} - {%- if not theme_source_branch -%} - {{ warning("Provided `source_repository` but not `source_branch`. ")}} - {%- endif -%} - {%- if page_source_suffix -%} - {{ furo_edit_button(determine_page_edit_link()) }} - {%- endif -%} -{%- elif READTHEDOCS and conf_py_path and page_source_suffix and github_user != "None" and github_repo != "None" and github_version %} +{% block link_not_available %} +{# Make nice things happen, on Read the Docs #} +{%- if 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 + "/edit/" + github_version + conf_py_path + pagename + page_source_suffix %} {{ furo_edit_button(url) }} {%- endif -%} +{% endblock %}