如何在Sphinx中定义应使用的.rst文件和目录? [英] How I can define in Sphinx which .rst files and directories should be used?
问题描述
如何在Sphinx中定义应使用哪个.rst文件和目录?
我想在我的测试/构建/文档脚本中包含一个自动文档生成器. 在我的工作空间中执行了 sphinx-quickstart ,并创建了一个index.rst文件.当Sphinx使用重组的文本文件作为文档时,我在工作区中导航并使用 sphinx-autogen 手动创建它们.它进入了task.rst文件(见下文).
当我使用"make html"时,我会收到一些警告:
警告:自动模块的无效签名(u'tasks/add_to_config')
警告:autodoc无法导入/查找模块'tasks.add_to_config',报告错误:没有名为wl_build.tasks的模块",请检查您的拼写和sys.path >
警告:不知道要导入哪个模块以自动记录u'tasks/add_to_config'(尝试在文档中放置"module"或"currentmodule"指令,或给出明确的模块名称)
...
我的index.rst
Welcome to build's documentation!
====================================
Contents:
.. toctree::
:maxdepth: 2
.. automodule:: tasks/add_to_config
:members:
.. automodule:: tasks/build_egg
:members:
tasks.rst
tasks Package
=============
:mod:`tasks` Package
--------------------
.. automodule:: tasks.__init__
:members:
:undoc-members:
:show-inheritance:
:mod:`add_to_config` Module
---------------------------
.. automodule:: tasks.add_to_config
:members:
:undoc-members:
:show-inheritance:
:mod:`build_egg` Module
-----------------------
.. automodule:: tasks.build_egg
:members:
:undoc-members:
:show-inheritance:
尝试用句点(.
)替换index.rst文件中的/
字符
像这样:
Welcome to build's documentation!
====================================
Contents:
.. toctree::
:maxdepth: 2
.. automodule:: tasks.add_to_config
:members:
.. automodule:: tasks.build_egg
:members:
看看是否有帮助.
如果Sphinx仍然找不到要编写的代码,那么您可能需要修改PYTHONPATH
或更改conf.py
文件中的sys.path
,以帮助Sphinx查找所需的内容.
How I can define in Sphinx which .rst files and directories should be used?
I want to include an automatic documentation generator in my testing/building/documentation script. sphinx-quickstart was executed in my workspace and created an index.rst-file. As Sphinx uses restructured text files for documentation I navigated through the workspace and create them manually with sphinx-autogen. It resulted into the tasks.rst file (see below).
When I use 'make html' I get several warnings:
WARNING: invalid signature for automodule (u'tasks/add_to_config')
WARNING: autodoc can't import/find module 'tasks.add_to_config', it reported error: "No module named wl_build.tasks", please check your spelling and sys.path
WARNING: don't know which module to import for autodocumenting u'tasks/add_to_config' (try placing a "module" or "currentmodule" directive in the document, or giving an explicit module name)
...
My index.rst
Welcome to build's documentation!
====================================
Contents:
.. toctree::
:maxdepth: 2
.. automodule:: tasks/add_to_config
:members:
.. automodule:: tasks/build_egg
:members:
tasks.rst
tasks Package
=============
:mod:`tasks` Package
--------------------
.. automodule:: tasks.__init__
:members:
:undoc-members:
:show-inheritance:
:mod:`add_to_config` Module
---------------------------
.. automodule:: tasks.add_to_config
:members:
:undoc-members:
:show-inheritance:
:mod:`build_egg` Module
-----------------------
.. automodule:: tasks.build_egg
:members:
:undoc-members:
:show-inheritance:
Try replacing the /
characters in your index.rst file with periods (.
)
like this:
Welcome to build's documentation!
====================================
Contents:
.. toctree::
:maxdepth: 2
.. automodule:: tasks.add_to_config
:members:
.. automodule:: tasks.build_egg
:members:
See if that helps.
If Sphinx still can't find the code to document, then you'll probably need to modify your PYTHONPATH
or alter sys.path
in your conf.py
file in order to help Sphinx find what it's looking for.
这篇关于如何在Sphinx中定义应使用的.rst文件和目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!