作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有一些 python 模块,主要包含函数和一些类。每一个都在单独的第一个文件中使用 sphinx-autodoc 进行记录。我想做的是在每个页面的顶部创建一个表或模块内容列表,例如,mymodule.py 是
def first():
'First function'
def second():
'Second function'
而 mymodule.rst 是
Page Contents
-------------
:create_page_contents_list:
Members
-------
.. automodule:: mymodule
:members:
那么输出应该是这样的:
Page Contents
-------------
first
second
Members
-------
first()
First function
second()
Second function
:create_page_contents_list:
的问题。我看过使用目录,但似乎我需要为每个项目手动创建一个条目。我也看过自动摘要,但我仍然需要列出成员。有什么自动化的建议吗?我宁愿避免第三方扩展。
最佳答案
您可能想要 autosummary extension 之类的东西.不过,实际的自动摘要扩展不会完全满足您的要求。
in this answer 给出了一个关于如何扩展自动摘要以自动检测模块内容的示例。
关于python - 狮身人面像 : list of functions in a module,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9770756/
我是一名优秀的程序员,十分优秀!