From be94e5b686880eee6b49c91ff853122717a14411 Mon Sep 17 00:00:00 2001 From: x54-729 <17307130121@fudan.edu.cn> Date: Thu, 19 May 2022 09:04:58 +0000 Subject: [PATCH] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E6=9E=84=E5=BB=BA=E5=A4=9A?= =?UTF-8?q?=E5=88=86=E6=94=AF=E6=96=87=E6=A1=A3=E7=9A=84=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E5=92=8C=E6=96=87=E4=BB=B6=202.=E9=87=8D=E5=91=BD=E5=90=8DJenk?= =?UTF-8?q?insfile=E4=B8=BA.Jenkinsfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile => .Jenkinsfile | 0 docs/Makefile | 5 ++++- docs/requirements.txt | 3 ++- docs/source/_templates/versions.html | 27 +++++++++++++++++++++++++++ docs/source/conf.py | 11 +++++++++-- 5 files changed, 42 insertions(+), 4 deletions(-) rename Jenkinsfile => .Jenkinsfile (100%) create mode 100644 docs/source/_templates/versions.html diff --git a/Jenkinsfile b/.Jenkinsfile similarity index 100% rename from Jenkinsfile rename to .Jenkinsfile diff --git a/docs/Makefile b/docs/Makefile index d6c4f6b6..fd4035db 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -9,7 +9,7 @@ SPHINXPROJ = fastNLP SPHINXEXCLUDE = ../fastNLP/transformers/* SOURCEDIR = source BUILDDIR = build -PORT = 9000 +PORT = 8000 # Put it first so that "make" without argument is like "make help". help: @@ -30,6 +30,9 @@ web: dev: make delete && make apidoc && make html && make server +versions: + sphinx-multiversion "$(SOURCEDIR)" "$(BUILDDIR)" && cd build && python -m http.server $(PORT) + prod: make apidoc && make html diff --git a/docs/requirements.txt b/docs/requirements.txt index 45450867..91e78913 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,4 @@ sphinx sphinx_rtd_theme -sphinx_autodoc_typehints \ No newline at end of file +sphinx_autodoc_typehints +sphinx-multiversion \ No newline at end of file diff --git a/docs/source/_templates/versions.html b/docs/source/_templates/versions.html new file mode 100644 index 00000000..476c8d19 --- /dev/null +++ b/docs/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 %} \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 2ed8ac96..01884ef7 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -43,7 +43,8 @@ extensions = [ 'sphinx.ext.autosummary', 'sphinx.ext.mathjax', 'sphinx.ext.todo', - 'sphinx_autodoc_typehints' + 'sphinx_autodoc_typehints', + 'sphinx_multiversion', ] autodoc_default_options = { @@ -116,7 +117,11 @@ html_static_path = ['_static'] # 'searchbox.html']``. # # html_sidebars = {} - +html_sidebars = { + '**': [ + 'versions.html', + ], +} # -- Options for HTMLHelp output --------------------------------------------- @@ -168,6 +173,8 @@ texinfo_documents = [ 'Miscellaneous'), ] +# -- Options for Multiversions ---------------------------------------------- +smv_latest_version = 'dev0.8.0' # -- Extension configuration ------------------------------------------------- def maybe_skip_member(app, what, name, obj, skip, options):