本文介绍了Python:我如何在sphinx中定义应该使用哪个.rst文件和目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在sphinx中定义应该使用哪个.rst文件和目录?



我想将自动文档生成器我的测试/建筑/文档脚本。
sphinx-quickstart 在我的工作空间中执行,并创建了一个index.rst-file。由于sphinx使用重组的文本文件进行文档导航,通过工作区导航,并使用 sphinx-autogen 手动创建文本。它导致了tasks.rst文件(见下文)。



当我使用'make html'时,我会收到几条警告:

我的index.rst

 欢迎来到构建文档! 
================================

内容:

.. toctree ::
:maxdepth:2

.. automodule :: tasks / add_to_config
:会员:

.. automodule :: tasks / build_egg
:成员:

任务.rst

 任务包
=============

:mod:`tasks`包
--------------------

.. automodule: :任务.__ init__
:成员:
:undoc成员:
:显示继承:

:mod:`add_to_config`模块
- -------------------------

.. automodule :: tasks.add_to_config
:成员:
:undoc-members:
:show-inheritance:

:mod:`build_egg`模块
--------------- --------

.. automodule :: tasks.build_egg
:成员:
:undoc-members:
:show-inheritance:


解决方案

尝试替换 / 您的index.rst文件中的字符(



像这样:

 欢迎来到构建文档! 
================================

内容:

.. toctree ::
:maxdepth:2

.. automodule :: tasks.add_to_config
:成员:

.. automodule :: tasks.build_egg
:成员:

看看是否有帮助。



如果Sphinx仍然找不到要记录的代码,那么您可能需要修改 PYTHONPATH 或更改 conf.py 文件中的 sys.path ,以帮助Sphinx找到所需的内容。 / p>

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:

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.

这篇关于Python:我如何在sphinx中定义应该使用哪个.rst文件和目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 07:16