Pylons项目文档的Sphinx主题。
项目描述
Pylons Sphinx Themes
此存储库是一个Python包,包含与Pylons相关项目的Sphinx主题。该项目基于 Pylons Sphinx Theme(单数),但使用包实现而不是git子模块和手动步骤。
要在Sphinx文档中使用主题,请遵循此指南。
编辑项目的 setup.py
将 pylons-sphinx-themes 添加到项目 setup.py 中的要求。以下是从Pyramid的示例。
docs_extras = [ 'Sphinx >= 1.7.5', # Read The Docs minimum version 'docutils', 'repoze.sphinx.autointerface', 'pylons-sphinx-themes', ]
编辑Sphinx的 conf.py
接近顶部,添加以下内容。
import pylons_sphinx_themes
激活主题。
html_theme = 'pyramid' html_theme_path = pylons_sphinx_themes.get_html_themes_path()
(推荐)启用 道德广告。这样做将支持 Read the Docs 和 Python软件基金会,并从广告收入中受益。
# Control display of sidebars html_sidebars = { '**': [ 'localtoc.html', 'ethicalads.html', 'relations.html', 'sourcelink.html', 'searchbox.html', ] }
如果您之前使用git子模块方法使用Pylons主题,那么请注释或删除以下语句下的代码块。
# Add and use Pylons theme if 'sphinx-build' in ' '.join(sys.argv): # protect against dumb importers
(可选) 设置规范根URL。该URL指向文档的根目录,并需要尾部斜杠。
html_theme_options = dict( canonical_url='http://the_root_domain/latest/docs/' )
撤销git子模块方法
如果您之前使用git子模块方法使用Pylons主题,那么请执行以下额外步骤。
删除.gitmodules。
cd <your_project_directory> git rm .gitmodules
取消初始化子模块。
cd docs/_themes git submodule deinit .
删除子模块的目录。
cd .. git rm _themes/
编辑您的Sphinx的Makefile。以下是从Pyramid的示例diff。
-html: themes +html: # ... -htmlhelp: themes +htmlhelp: #... -themes: - cd ..; git submodule update --init --recursive; cd docs;
更新tox.ini
如果您使用tox,可以在您的setup.py(首选)或tox.ini中指定构建文档的依赖关系(重复)。请参阅Pyramid的示例。
docs_extras = [
'Sphinx >= 1.7.5',
'docutils',
'repoze.sphinx.autointerface',
'pylons_sphinx_latesturl',
'pylons-sphinx-themes',
]
# ...
extras_require = {
'testing':testing_extras,
'docs':docs_extras,
},
否则,您可以重复操作并编辑您的tox.ini。以下是从waitress的示例。
deps =
Sphinx
repoze.sphinx.autointerface
pylons-sphinx-themes
更新Read the Docs配置
如果您在Read the Docs中指定了包需求,请在您的rtd.txt中指定依赖项。您可以直接命名它们,这可能是重复的
pylons-sphinx-themes
或者您可以根据您的setup.py配置,在rtd.txt中指定依赖项,只在一个地方指定,只需在您的rtd.txt中使用这个即可。
-e .[docs]
可用主题
pylons - Pylons项目的通用文档主题
pyramid - Pyramid文档的特定主题
pylonsfw - Pylons框架的特定文档主题
pylons-sphinx-themes的更改日志
1.0.13 (2020-11-30)
撤销表格中行号修复。Sphinx在v3.0中修复了此问题,RTD在2020年4月将其作为功能标志推出,现在似乎正在更多项目中推出。
为linenodiv顶部添加填充,使其与表格中的代码对齐及其额外的2px顶部边框。
1.0.12 (2020-11-28)
添加样式.wy-table-responsive { overflow-x: scroll; } 以防止长虚线方法名导致的表格溢出。
1.0.11 (2020-01-13)
修复在代码块中使用时行号表格列的宽度。
1.0.10 (2018-09-25)
将Read the Docs添加为广告收入的接收者。
1.0.9 (2018-09-23)
删除连字符,因为有时它在代码中不恰当地分割。
1.0.8 (2018-09-21)
修复对Ethical Ads的支持。
1.0.7 (2018-09-21)
为Read The Docs添加了对Ethical Ads的支持。请参阅https://github.com/Pylons/pylons-sphinx-themes/pull/12
1.0.6 (2017-09-22)
更新zest.releaser以发布到PyPI。
1.0.5 (2017-09-22)
1.0.4 (2017-06-20)
仅对于类.body中的列表项指定行间距。
1.0.3 (2017-06-20)
为列表项添加行间距。关闭#4。
1.0.2 (2017-06-16)
删除HTTPS协议,允许使用HTTPS或HTTP。
1.0.1 (2017-06-16)
使用HTTPS作为样式的协议。
1.0 (2017-04-18)
使用zest.releaser进行发布。
改进文档。
0.3.1 (2015-04-15)
改进文档。
0.3 (2015-04-15)
将使用git子模块的https://github.com/Pylons/pylons_sphinx_theme转换为包。请参阅https://github.com/Pylons/pyramid/issues/1614
首次提交。