From 8c5ae508f91d87648ae7f01d52f48bce4269cc22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 15 Jul 2021 13:12:59 +0200 Subject: [PATCH] Use html_extra_template_renderer to replace the current robots.txt rendering script --- docs/conf.py | 6 +++++- scripts/docs.sh | 1 - scripts/update_robotstxt.sh | 27 --------------------------- 3 files changed, 5 insertions(+), 29 deletions(-) delete mode 100755 scripts/update_robotstxt.sh diff --git a/docs/conf.py b/docs/conf.py index 01f0d1d3b..573da2465 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -161,7 +161,7 @@ html_js_files = ["js/toggle.js"] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. -html_extra_path = ["_static/css", "_static/robots.txt"] +html_extra_path = ["_static/css"] # List of templates of static files to be included in the HTML output. # Keys represent paths to input files and values are dicts containing: @@ -170,6 +170,10 @@ html_extra_path = ["_static/css", "_static/robots.txt"] # All paths must be absolute. # Rendered templates are automatically added to html_extra_path setting. html_extra_templates = { + os.path.join(ROOT_PATH, "robots.txt.template"): { + 'target': os.path.join(ROOT_PATH, "_static/robots.txt"), + 'context': {'LATEST_VERSION': version}, + } } # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, diff --git a/scripts/docs.sh b/scripts/docs.sh index e2493511b..4d31277da 100755 --- a/scripts/docs.sh +++ b/scripts/docs.sh @@ -27,7 +27,6 @@ #------------------------------------------------------------------------------ set -e -scripts/update_robotstxt.sh cd docs pip3 install -r requirements.txt sphinx-build -nW -b html -d _build/doctrees . _build/html diff --git a/scripts/update_robotstxt.sh b/scripts/update_robotstxt.sh deleted file mode 100755 index cd09c1433..000000000 --- a/scripts/update_robotstxt.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash - -#------------------------------------------------------------------------------ -# solidity is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# solidity is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with solidity. If not, see -# -# (c) 2021 solidity contributors. -#------------------------------------------------------------------------------ - -set -eu - -repo_root="$(dirname "$0")/.." -robots_template_path="${repo_root}/docs/robots.txt.template" -robots_txt_path="${repo_root}/docs/_static/robots.txt" -latest_version=$("${repo_root}/scripts/get_version.sh") - -sed -E -e "s/\{\{[[:space:]]LATEST_VERSION[[:space:]]\}\}/${latest_version}/g" "$robots_template_path" > "$robots_txt_path"