Skip to content

Commit

Permalink
[Docs] Add version banner and version warning in master docs. (#1216)
Browse files Browse the repository at this point in the history
  • Loading branch information
mzr1996 authored Dec 5, 2022
1 parent 578c035 commit 8387358
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 38 deletions.
54 changes: 36 additions & 18 deletions docs/en/conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
Expand Down Expand Up @@ -87,41 +88,58 @@ def get_version():
# further. For a list of options available for each theme, see the
# documentation.
#
# yapf: disable
html_theme_options = {
'logo_url':
'https://mmclassification.readthedocs.io/en/latest/',
'logo_url': 'https://mmclassification.readthedocs.io/en/latest/',
'menu': [
{
'name': 'GitHub',
'url': 'https://github.com/open-mmlab/mmclassification'
},
{
'name':
'Colab Tutorials',
'name': 'Colab Tutorials',
'children': [
{
'name':
'Train and inference with shell commands',
'url':
'https://colab.research.google.com/github/'
'open-mmlab/mmclassification/blob/master/docs/en/'
'tutorials/MMClassification_tools.ipynb',
'name': 'Train and inference with shell commands',
'url': 'https://colab.research.google.com/github/open-mmlab/mmclassification/blob/master/docs/en/tutorials/MMClassification_tools.ipynb',
},
{
'name':
'Train and inference with Python APIs',
'url':
'https://colab.research.google.com/github/'
'open-mmlab/mmclassification/blob/master/docs/en/'
'tutorials/MMClassification_python.ipynb',
'name': 'Train and inference with Python APIs',
'url': 'https://colab.research.google.com/github/open-mmlab/mmclassification/blob/master/docs/en/tutorials/MMClassification_python.ipynb',
},
]
},
{
'name': 'Version',
'children': [
{
'name': 'MMClassification 0.x',
'url': 'https://mmclassification.readthedocs.io/en/latest/',
'description': 'master branch'
},
{
'name': 'MMClassification 1.x',
'url': 'https://mmclassification.readthedocs.io/en/dev-1.x/',
'description': '1.x branch'
},
],
}
],
# Specify the language of shared menu
'menu_lang':
'en'
'menu_lang': 'en',
'header_note': {
'content':
'You are reading the documentation for MMClassification 0.x, which '
'will soon be deprecated at the end of 2022. We recommend you upgrade '
'to MMClassification 1.0 to enjoy fruitful new features and better '
'performance brought by OpenMMLab 2.0. Check the '
'<a href="https://mmclassification.readthedocs.io/en/dev-1.x/get_started.html#installation">installation tutorial</a>, '
'<a href="https://mmclassification.readthedocs.io/en/dev-1.x/migration.html">migration tutorial</a> '
'and <a href="https://mmclassification.readthedocs.io/en/dev-1.x/notes/changelog.html">changelog</a> '
'for more details.',
}
}
# yapf: enable

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down
53 changes: 34 additions & 19 deletions docs/zh_CN/conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
Expand Down Expand Up @@ -86,42 +87,56 @@ def get_version():
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# yapf: disable
html_theme_options = {
'logo_url':
'https://mmclassification.readthedocs.io/zh_CN/latest/',
'logo_url': 'https://mmclassification.readthedocs.io/zh_CN/latest/',
'menu': [
{
'name': 'GitHub',
'url': 'https://github.com/open-mmlab/mmclassification'
},
{
'name':
'Colab 教程',
'name': 'Colab 教程',
'children': [
{
'name':
'用命令行工具训练和推理',
'url':
'https://colab.research.google.com/github/'
'open-mmlab/mmclassification/blob/master/docs/zh_CN/'
'tutorials/MMClassification_tools_cn.ipynb',
'name': '用命令行工具训练和推理',
'url': 'https://colab.research.google.com/github/open-mmlab/mmclassification/blob/master/docs/zh_CN/tutorials/MMClassification_tools_cn.ipynb',
},
{
'name':
'用 Python API 训练和推理',
'url':
'https://colab.research.google.com/github/'
'open-mmlab/mmclassification/blob/master/docs/zh_CN/'
'tutorials/MMClassification_python_cn.ipynb',
'name': '用 Python API 训练和推理',
'url': 'https://colab.research.google.com/github/open-mmlab/mmclassification/blob/master/docs/zh_CN/tutorials/MMClassification_python_cn.ipynb',
},
]
},
{
'name': '版本',
'children': [
{
'name': 'MMClassification 0.x',
'url': 'https://mmclassification.readthedocs.io/zh_CN/latest/',
'description': 'master 分支'
},
{
'name': 'MMClassification 1.x',
'url': 'https://mmclassification.readthedocs.io/zh_CN/dev-1.x/',
'description': '1.x 分支'
},
],
}
],
# Specify the language of shared menu
'menu_lang':
'cn',
'menu_lang': 'cn',
'header_note': {
'content':
'您正在阅读 MMClassification 0.x 版本的文档。MMClassification 0.x 会在 2022 年末'
'被切换为次要分支。建议您升级到 MMClassification 1.0 版本,体验更多新特性和新功能。'
'请查阅 MMClassification 1.0 的'
'<a href="https://mmclassification.readthedocs.io/zh_CN/dev-1.x/get_started.html#installation">安装教程</a>、'
'<a href="https://mmclassification.readthedocs.io/zh_CN/dev-1.x/migration.html">迁移教程</a>'
'以及<a href="https://mmclassification.readthedocs.io/en/dev-1.x/notes/changelog.html">更新日志</a>。',
}
}
# yapf: enable

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down
2 changes: 1 addition & 1 deletion requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
docutils==0.17.1
myst-parser
-e git+https://github.com/open-mmlab/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
git+https://github.com/open-mmlab/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
sphinx==4.5.0
sphinx-copybutton
sphinx_markdown_tables

0 comments on commit 8387358

Please sign in to comment.