如何使用sphinxcontribmatlabdomain编写多个类的Matlab项目?

2024-04-27 09:10:56 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图用Sphinx和sphinxcontrib matlabdomain包记录一个更大的Matlab项目。它适用于存储所有.m文件的单个文件夹。但是,我的项目包含多个存储在不同文件夹中的类,例如:

   project
    |-- matfiles
    |    |-- @class1
    |    |    |-- class1.m
    |    |    |-- method1.m
    |    |    |-- method2.m
    |    |    +-- method1.m
    |    |-- @class2
    |    |    |-- class2.m
    |    |    |-- methodA.m
    |    |    |-- methodB.m
    |    |    +-- methodC.m
    |    +-- function
    |         |-- fun1.m
    |         |-- fun2.m
    |         +-- fun3.m
    +-- doc
         |-- conf.py
         +-- index.rst

我将以下行添加到conf.py

^{pr2}$

我在index.rst中添加了以下行:

.. module:: matfiles

.. automethod:: class1.method1

我得到了以下错误:

Exception occurred:
  File "/Library/Python/2.7/site-packages/sphinxcontrib/mat_documenters.py", line 788, in import_object
    if self.object.attrs.get('Static'):
AttributeError: 'NoneType' object has no attribute 'attrs'
The full traceback has been saved in /var/folders/70/g0lr37wn60gbbymnsks_t5vm0000gn/T/sphinx-err-uD8qpe.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
| reading sources... [100%] index

所以我的问题是,有没有一种方法来记录多类Matlab项目,其中类方法保存在名为@class的文件夹中?在


Tags: the项目inpyreport文件夹indexif