我有重要的 MATLAB 库,我想通过 Sphinx 记录它们。数据结构大致如下
|- Matlab
|- scripts
|- functions
|- docs
|- source
|- conf.py
|- index.rst
|- Makefile
|- make.bat
|- ...
conf.py 中的相关行是
import os
extensions = [
'sphinx.ext.viewcode', 'sphinx.ext.autodoc', 'sphinxcontrib.matlab'
]
this_dir = os.path.dirname(os.path.abspath('Matlab'))
matlab_src_dir = os.path.abspath(os.path.join(this_dir, '..'))
primary_domain = 'mat'
从
make html
运行 /docs
时?我没有收到任何错误,但没有生成任何文档。
日志
Running Sphinx v5.0.2
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 0 changed, 0 removed
looking for now-outdated files... none found
no targets are out of date.
build succeeded.
The HTML pages are in _build\html.
在您的index.rst 文件(或index.rst 指向的其他.rst 文件)中,您需要一个指令来关闭它。像这样的东西可能会在你的index.rst中起作用:
Matlab.functions
=================
.. mat:automodule:: Matlab.functions
:members:
:show-inheritance:
:undoc-members:
我强烈建议查看 matlabdomain github 中的代码示例。