2016-11-29 41 views
0

现在我的文档/来源有一个index.rst,在其doctree导入另一个文件,称为api.rst。我想这个api.rst文件autodoc一个python模块。这个模块是一个.py,许多函数没有附加到任何类,但它们按功能分组。我可以编写API文件是这样的:Readthedocs:有没有办法在一个文件中分别自动分配相同的模型函数?

fbbotw api 
========== 

.. automodule:: fbbotw 
    :members: 

然而,将车博士的所有功能,而无需考虑这些群体。现在,我想这样做,使用.. autofunction::指令是这样的:

fbbotw Functions reference 
========================== 

Graph API Functions 
------------------- 

.. autofunction:: fbbotw.get_user_information 


Send Api Functions 
------------------ 

Sender Actions 
~~~~~~~~~~~~~~ 

.. autofunction:: fbbotw.typing 

Content Types 
~~~~~~~~~~~~~ 

.. autofunction:: fbbotw.post_text_message 
.. autofunction:: fbbotw.post_audio_attachment 
.. autofunction:: fbbotw.post_file_attachment 
.. autofunction:: fbbotw.post_image_attachment 
.. autofunction:: fbbotw.post_video_attachment 

Quick Replies 
~~~~~~~~~~~~~ 

.. autofunction:: fbbotw.post_text_w_quickreplies 


Templates 
~~~~~~~~~ 

.. autofunction:: fbbotw.post_button_template 
.. autofunction:: fbbotw.post_generic_template 
.. autofunction:: fbbotw.post_list_template 
.. autofunction:: fbbotw.post_receipt_template 

Buttons 
~~~~~~~ 

.. autofunction:: fbbotw.post_call_button 


Thread Settings Functions 
------------------------- 

.. autofunction:: fbbotw.post_settings 
.. autofunction:: fbbotw.post_greeting_text 
.. autofunction:: fbbotw.post_start_button 
.. autofunction:: fbbotw.post_persistent_menu 
.. autofunction:: fbbotw.post_domain_whitelisting 
.. autofunction:: fbbotw.post_account_linking_url 

它本地工作,但网上readthedocs只创建的api.rst的冠军,但在.. autofunction::没有做任何事情。是否有另一种方式来做到这一点,或者我错过了任何配置?

我曾尝试其他的事情:

对于每一个组中api.rst创建另一个文件,并将其导入toctree,和这些组中的文件使用.. automodule: fbbotw :members: function1, function2...指定我想在该文件中,以车博士成员。

我真的怀疑它可能是readthedocs admin上的一个错误配置,我无法使它在线工作,因为它在本地都能正常工作。

+1

你尝试使用[sphinx-apidoc](https://codeandchaos.wordpress.com/2012/07/30/sphinx-autodoc-tutorial-for-dummies/)(页面的buttom)for自动文档 – Tobey

+0

autodocs是否在readthedocs上工作? –

+0

@Tobey大部分教程对于readthedocs的入门都是一样的,所以它和我一样。 –

回答

0

狮身人面像有一个autodocs api自动生成您的包第一个文件。在autodocs运行并添加更多信息后,您可以先编辑它们。运行autodocs时要小心,因为它可能会覆盖较旧的文件。

0

通过@MikhailKorobov在评论中回答:

所以自动功能VS automodule问题是没有关系的,它是 autodocs这是不工作的,对不对?他们有这个 问题FAQ部分: http://read-the-docs.readthedocs.io/en/latest/faq.html#my-project-isn-t-building-with-autodoc

有我的模块,使车博士无法设置它的ImportError。检查readthedocs构建日志我可以看到,这个ImportError没有在我的测试中被覆盖,而且构建文档的环境也不同。现在工作:http://fbbotw.readthedocs.io/en/latest/

相关问题