From 9cf1035b1dad835f9423c07aeb3bee8df0e63143 Mon Sep 17 00:00:00 2001 From: iswbm Date: Wed, 19 Jun 2024 21:51:01 +0800 Subject: [PATCH 1/4] update requirements.txt to python3.10.12 --- requirements.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/requirements.txt b/requirements.txt index 2058b9e..08d22be 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,22 +1,21 @@ alabaster==0.7.12 argh==0.26.2 -Babel==2.7.0 +Babel==2.9.1 certifi==2019.6.16 chardet==3.0.4 docutils==0.14 -idna==2.8 imagesize==1.1.0 -Jinja2==2.10.1 +Jinja2==2.11.3 livereload==2.6.1 MarkupSafe==1.1.1 packaging==19.0 pathtools==0.1.2 port-for==0.3.1 -Pygments==2.4.2 +Pygments==2.7.4 pyparsing==2.4.0 pytz==2019.1 -PyYAML==5.1.1 -requests==2.22.0 +PyYAML==6.0.1 +requests==2.32.3 six==1.12.0 snowballstemmer==1.9.0 Sphinx==2.1.2 @@ -29,7 +28,7 @@ sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.2 sphinxcontrib-serializinghtml==1.1.3 tornado==6.0.3 -urllib3==1.25.3 +urllib3==2.2.2 watchdog==0.9.0 sphinxcontrib-disqus==1.1.0 sphinxcontrib-applehelp==1.0.1 @@ -39,3 +38,4 @@ sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.2 sphinxcontrib-serializinghtml==1.1.3 sphinx-sitemap==2.2.0 +sphinx-multiversion==0.2.4 From 3ad7885224e45768e06a8d6f5ec34f71710ac374 Mon Sep 17 00:00:00 2001 From: iswbm Date: Wed, 19 Jun 2024 22:26:03 +0800 Subject: [PATCH 2/4] support sphinx-multiversion --- rebuild.sh | 13 +++++++++++++ source/_templates/versions.html | 27 +++++++++++++++++++++++++++ source/conf.py | 27 ++++++++++++--------------- 3 files changed, 52 insertions(+), 15 deletions(-) create mode 100755 rebuild.sh create mode 100644 source/_templates/versions.html diff --git a/rebuild.sh b/rebuild.sh new file mode 100755 index 0000000..3ceedd8 --- /dev/null +++ b/rebuild.sh @@ -0,0 +1,13 @@ +cat << EOF >/usr/local/lib/python3.10/site-packages/sphinx_rtd_theme/comments.html + + + +EOF + +rm -rf build/ && sphinx-multiversion source build/html && cp -rf build/html/master/* build/html/ diff --git a/source/_templates/versions.html b/source/_templates/versions.html new file mode 100644 index 0000000..31a1257 --- /dev/null +++ b/source/_templates/versions.html @@ -0,0 +1,27 @@ +{%- if current_version %} +
+ + Other Versions + v: {{ current_version.name }} + + +
+ {%- if versions.tags %} +
+
Tags
+ {%- for item in versions.tags %} +
{{ item.name }}
+ {%- endfor %} +
+ {%- endif %} + {%- if versions.branches %} +
+
Branches
+ {%- for item in versions.branches %} +
{{ item.name }}
+ {%- endfor %} +
+ {%- endif %} +
+
+{%- endif %} diff --git a/source/conf.py b/source/conf.py index fdcb6f7..66e5159 100644 --- a/source/conf.py +++ b/source/conf.py @@ -28,7 +28,7 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ['chinese_search','sphinx.ext.mathjax', 'sphinx_sitemap'] +extensions = ['chinese_search','sphinx.ext.mathjax', 'sphinx_sitemap', 'sphinx_multiversion'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -127,28 +127,25 @@ sys.path.append(os.path.abspath(_exts)) html_js_files = [ - 'js/readmore.js', + 'js/readmore.js', 'js/baidutongji.js', ] -# General configuration. -with open("/home/docs/checkouts/readthedocs.org/user_builds/pythoncodingtime/envs/latest/lib/python3.7/site-packages/sphinxcontrib/disqus.py", "r") as file: - content = file.read() - content=content.replace("sphinx.application", "sphinx.errors") - -with open("/home/docs/checkouts/readthedocs.org/user_builds/pythoncodingtime/envs/latest/lib/python3.7/site-packages/sphinxcontrib/disqus.py", "w") as file: - file.write(content) author = '王炳明' -copyright = '2020, Python编程时光' +copyright = '2020-2024, Python编程时光' exclude_patterns = ['_build'] -extensions = ['sphinxcontrib.disqus'] # Add to this list. master_doc = 'index' project = 'Python编程时光' -release = '1.0' -version = '1.0' # Options for extensions. -disqus_shortname = 'iswbm' # Add this line to conf.py. -html_baseurl = 'http://pythontime.iswbm.com' +html_baseurl = 'https://magic.iswbm.com' html_extra_path = ["robots.txt"] + +html_sidebars = { + '**': [ + 'versioning.html', + ], +} +smv_latest_version = 'master' +sitemap_url_scheme = "{link}" From 07ecd0ea6bc99c5d821c28fc560f551c0848d711 Mon Sep 17 00:00:00 2001 From: iswbm Date: Mon, 26 Jan 2026 22:12:53 +0800 Subject: [PATCH 3/4] update requirements.txt to python3.6.8 --- rebuild.sh | 2 +- requirements.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rebuild.sh b/rebuild.sh index 3ceedd8..319b303 100755 --- a/rebuild.sh +++ b/rebuild.sh @@ -1,4 +1,4 @@ -cat << EOF >/usr/local/lib/python3.10/site-packages/sphinx_rtd_theme/comments.html +cat << EOF >/usr/local/lib/python3.6/site-packages/sphinx_rtd_theme/comments.html