我尝试使用Sphinx matlab domain和autosummary扩展来为工具箱中的几个MATLAB函数生成文档。这些函数的文档中的ReST文件如下所示:
.. currentmodule:: mytoolbox
.. autosummary::
:toctree: generated/
:nosignatures:
func1
虽然我将matlab_src_dir
设置为包含工具箱子目录且autosummary_generate
设置为True的正确基本目录,但自动扩展扩展会发出警告,表明它未能导入' ; mytoolbox.func1':没有名为mytoolbox.func1"的模块。 autosummary扩展是否适用于MATLAB域?如果是这样,我可能会错误配置什么?我的conf.py
文件包含以下内容:
import sys, os
extensions = ['sphinxcontrib.matlab',
'sphinx.ext.pngmath',
'sphinx.ext.viewcode',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary']
needs_sphinx = '1.0'
templates_path = ['_templates']
autosummary_generate = True
source_suffix = '.rst'
master_doc = 'index'
language = 'en'
exclude_patterns = ['build']
pygments_style = 'sphinx'
matlab_src_dir = os.path.abspath('../../')
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd:
html_theme = 'default'
else:
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_domain_indices = False
html_use_index = True