禁用sphinx autod中的模块成员内容

2024-09-30 01:25:14 发布

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

我正在使用sphinx自动编写python模块的文档。例如,我的代码在文件中是这样的测试.py地址:

Number2Name = {'1': u'中文', '3': u'英文'}
"""
字典数据结构 # Dictionary data structures
"""

在rst文件中写入时:

.. automodule:: test
    :members:

它将生成正确的html页面,但使用Unicode字符串而不是汉字,如:

test.Number2Name={'1': u'\u4e2d\u6587', '3': u'\u82f1\u6587'}
字典数据类型结构

当数据中包含越来越多的信息时,这就变得很烦人了,因为它提供了不可读的信息,而在html页面中占据了很多位置。你知道吗

所以我想知道Sphinx是否可以禁用显示模块中变量的值。将页面设置为这样:

test.Number2Name
字典数据类型结构

我读了http://www.sphinx-doc.org/en/stable/ext/autodoc.html#module-sphinx.ext.autodoc,但找不到解决办法。我想我应该修改sphinx源代码来支持这个特性?你知道吗


Tags: 模块文件文档test信息字典htmlsphinx

热门问题