@@ -9,7 +9,7 @@ SPHINXPROJ = fastNLP | |||||
SPHINXEXCLUDE = ../fastNLP/transformers/* | SPHINXEXCLUDE = ../fastNLP/transformers/* | ||||
SOURCEDIR = source | SOURCEDIR = source | ||||
BUILDDIR = build | BUILDDIR = build | ||||
PORT = 9000 | |||||
PORT = 8000 | |||||
# Put it first so that "make" without argument is like "make help". | # Put it first so that "make" without argument is like "make help". | ||||
help: | help: | ||||
@@ -30,6 +30,9 @@ web: | |||||
dev: | dev: | ||||
make delete && make apidoc && make html && make server | make delete && make apidoc && make html && make server | ||||
versions: | |||||
sphinx-multiversion "$(SOURCEDIR)" "$(BUILDDIR)" && cd build && python -m http.server $(PORT) | |||||
prod: | prod: | ||||
make apidoc && make html | make apidoc && make html | ||||
@@ -1,3 +1,4 @@ | |||||
sphinx | sphinx | ||||
sphinx_rtd_theme | sphinx_rtd_theme | ||||
sphinx_autodoc_typehints | |||||
sphinx_autodoc_typehints | |||||
sphinx-multiversion |
@@ -0,0 +1,27 @@ | |||||
{%- if current_version %} | |||||
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions"> | |||||
<span class="rst-current-version" data-toggle="rst-current-version"> | |||||
<span class="fa fa-book"> Other Versions</span> | |||||
v: {{ current_version.name }} | |||||
<span class="fa fa-caret-down"></span> | |||||
</span> | |||||
<div class="rst-other-versions"> | |||||
{%- if versions.tags %} | |||||
<dl> | |||||
<dt>Tags</dt> | |||||
{%- for item in versions.tags %} | |||||
<dd><a href="{{ item.url }}">{{ item.name }}</a></dd> | |||||
{%- endfor %} | |||||
</dl> | |||||
{%- endif %} | |||||
{%- if versions.branches %} | |||||
<dl> | |||||
<dt>Branches</dt> | |||||
{%- for item in versions.branches %} | |||||
<dd><a href="{{ item.url }}">{{ item.name }}</a></dd> | |||||
{%- endfor %} | |||||
</dl> | |||||
{%- endif %} | |||||
</div> | |||||
</div> | |||||
{%- endif %} |
@@ -43,7 +43,8 @@ extensions = [ | |||||
'sphinx.ext.autosummary', | 'sphinx.ext.autosummary', | ||||
'sphinx.ext.mathjax', | 'sphinx.ext.mathjax', | ||||
'sphinx.ext.todo', | 'sphinx.ext.todo', | ||||
'sphinx_autodoc_typehints' | |||||
'sphinx_autodoc_typehints', | |||||
'sphinx_multiversion', | |||||
] | ] | ||||
autodoc_default_options = { | autodoc_default_options = { | ||||
@@ -116,7 +117,11 @@ html_static_path = ['_static'] | |||||
# 'searchbox.html']``. | # 'searchbox.html']``. | ||||
# | # | ||||
# html_sidebars = {} | # html_sidebars = {} | ||||
html_sidebars = { | |||||
'**': [ | |||||
'versions.html', | |||||
], | |||||
} | |||||
# -- Options for HTMLHelp output --------------------------------------------- | # -- Options for HTMLHelp output --------------------------------------------- | ||||
@@ -168,6 +173,8 @@ texinfo_documents = [ | |||||
'Miscellaneous'), | 'Miscellaneous'), | ||||
] | ] | ||||
# -- Options for Multiversions ---------------------------------------------- | |||||
smv_latest_version = 'dev0.8.0' | |||||
# -- Extension configuration ------------------------------------------------- | # -- Extension configuration ------------------------------------------------- | ||||
def maybe_skip_member(app, what, name, obj, skip, options): | def maybe_skip_member(app, what, name, obj, skip, options): | ||||