python - 使用 Sphinx 生成文档时缺少类 make latexpdf
问题描述
我正在使用 Sphinx 在 python 中生成文档。虽然make html
工作得很好,但我遇到了问题make latexpdf
。.tex
文件生成不完整。它缺少一些描述,这些描述包含在 html 中。我看不出问题出在哪里?例如,Calendar 类不显示在 Latex 中:
乳胶 [1]:https ://i.stack.imgur.com/XVJYg.png HTML [2]:https ://i.stack.imgur.com/4daHV.png
我conf.py
正在使用:
import os
import sys
sys.path.insert(0, os.path.abspath('../../src'))
sys.setrecursionlimit(1500)
project = '..'
copyright = '..'
author = '..'
release = '2.0'
extensions = ['rinoh.frontend.sphinx', 'sphinx.ext.autodoc']
exclude_patterns = []
html_theme = 'alabaster'
html_static_path = ['_static']
dialogs.rst
:
GUI Dialogs
===========
Login
------
.. automodule:: dialogs.login
:members:
:undoc-members:
:show-inheritance:
Calendar
--------
.. automodule:: dialogs.calendar
:members:
:undoc-members:
:show-inheritance:
更新使用时会出现几个警告make latexpdf
。我不知道他们是否是原因。对于日历模块和任何其他模块,警告如下:
WARNING: Explicit markup ends without a blank line; unexpected unindent.
WARNING: autodoc: failed to import module 'calendar' from module 'dialogs'; the following exception was raised:
File "c:\users\user\pycharmprojects\gui\venv\lib\site-packages\sphinx\ext\autodoc\importer.py", line 70, in import_module
return importlib.import_module(modname)
...
data_loaded = threading.Event()
NameError: name 'threading' is not defined
看起来它无法识别该threading
库。
解决方案
您需要遵循错误的建议并添加空格和空行。还要确保下划线与其标题的长度相匹配。
为了便于阅读,我喜欢在下一节之前添加两个空行,但只需要一个。节标题后也不需要有空行,但我还是更喜欢它的可读性。
GUI Dialogs
===========
Login
-----
.. automodule:: dialogs.login
:members:
:undoc-members:
:show-inheritance:
Calendar
--------
.. automodule:: dialogs.calendar
:members:
:undoc-members:
:show-inheritance:
推荐阅读
- filter - 仅排名最近一个月
- menu - 如何在 Flutter 中使用 inkwell 在按下时弹出菜单
- json - 将推特数据导入熊猫时跳过属性错误
- ios - 金属颜色表示问题(使用 sRGB 像素格式)
- visual-studio-2017 - 如何在 Visual Studio 中多次编译 hlsl 着色器?
- c# - 日历参数未显示在 asp 报表查看器中
- ruby-on-rails - 使用 Rails 5,为每条新记录生成和使用 Basecamp 风格的“hash_id”(而不是顺序行 id)的最有效方法是什么?
- javascript - 在以下称为 url 上设置 Referrer 值
- google-cloud-platform - 如何使用部署管理器将服务帐户添加到实例模板
- airflow - Airflow 1.9.0 - 任务执行之间的长时间延迟