diff --git a/rebuild.sh b/rebuild.sh new file mode 100755 index 0000000..319b303 --- /dev/null +++ b/rebuild.sh @@ -0,0 +1,13 @@ +cat << EOF >/usr/local/lib/python3.6/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/requirements.txt b/requirements.txt index 2058b9e..2a34b8d 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 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..d15ed1c 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}"