From 98bb89d5e310c11d26cf42734586d6bb9a160d2a Mon Sep 17 00:00:00 2001 From: Unai Martinez-Corral Date: Fri, 21 Oct 2022 00:27:44 +0200 Subject: [PATCH] add theme option 'pdf_url' Signed-off-by: Unai Martinez-Corral --- sphinx_immaterial/__init__.py | 2 ++ sphinx_immaterial/theme.conf | 3 +++ src/partials/header.html | 15 +++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/sphinx_immaterial/__init__.py b/sphinx_immaterial/__init__.py index 7c088053a..43fa26996 100644 --- a/sphinx_immaterial/__init__.py +++ b/sphinx_immaterial/__init__.py @@ -32,6 +32,7 @@ "search": {}, }, "icon": {}, + "pdf_url": "", "repo_url": "", "edit_uri": "", "globaltoc_collapse": True, @@ -214,6 +215,7 @@ def html_page_context( "theme": theme_options, "site_url": theme_options.get("site_url"), "site_name": context["docstitle"], + "pdf_url": theme_options.get("pdf_url"), "repo_url": theme_options.get("repo_url"), "repo_name": theme_options.get("repo_name", None), "extra": { diff --git a/sphinx_immaterial/theme.conf b/sphinx_immaterial/theme.conf index 5da745f2e..9f1630847 100644 --- a/sphinx_immaterial/theme.conf +++ b/sphinx_immaterial/theme.conf @@ -52,6 +52,9 @@ repo_name = # source file. This is typically in the form of 'blob//'. edit_uri = +# Relative or absolute location of the PDF +pdf_url = + # Sitemap generation # Specify a base_url used to generate sitemap.xml links. If not specified, then # no sitemap will be built. diff --git a/src/partials/header.html b/src/partials/header.html index 46b69256b..8baebfff0 100644 --- a/src/partials/header.html +++ b/src/partials/header.html @@ -134,6 +134,21 @@ {% endif %} + + {% if config.pdf_url %} + + {% endif %} + {% if "search" in config.plugins %}