我有重要的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'
当从/docs
运行make html
时?我没有得到任何错误,但没有生成任何文档。
日志
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.
1条答案
按热度按时间nwwlzxa71#
在您的index.rst文件(或index.rst指向的其他.rst文件)中,您需要一个指令来关闭关键字。类似这样的东西可能在你的index.rst中起作用:
我强烈建议查看matlabdomain github中的代码示例。
看起来你的matlab源目录也有点不对劲。根据你的结构,我认为应该是这样的:
还有一件事如果你想把注解从你的代码头中拉出来,你还需要在某个时候运行autodoc。sphinx quickstart将把执行放在make.bat文件中,或者您可以手动运行它。我有一个python脚本来运行它(而不是make)。然而,呼吁是:
其中(如果在您的基本目录下运行){doc_dir}是./docs,{code_dir}是./Matlab