doctree

Create doc tree if you follows Sanhe Sphinx standard.

class docfly.doctree.ArticleFolder(dir_path=None)[source]

Represent an index.rst file with Title sitting in a directory.

Parameters:
  • dir_path – A folder contains single rst file. The rst file path will be {dir_path}/{_filename}.
  • title – The title line above ‘==========’

中文文档

一篇 Article 代表着一个位于文件夹内的 index.rst 文件. 其中必然有至少一个标题元素.

rst_path

The actual rst file absolute path.

rel_path

File relative path from the folder.

title

Title for the first header.

get_title()[source]

Get title line from .rst file.

中文文档

从一个 _filename 所指定的 .rst 文件中, 找到顶级标题. 也就是第一个 ====----~~~~ 上面一行.

sub_article_folders

Returns all valid ArticleFolder sitting inside of ArticleFolder.dir_path.

toc_directive(maxdepth=1)[source]

Generate toctree directive text.

Parameters:
  • table_of_content_header
  • header_bar_char
  • header_line_length
  • maxdepth
Returns:

class docfly.doctree.DocTree[source]

This class is designed for taking a rst file, and find all .. articles:: directives, then automatically generate .. toctree:: directive.

The file structure has to follow Sanhe Sphinx standard.

Deprecated since version 0.: message

classmethod fly(conf_path, docname, source, maxdepth=1)[source]

Generate toctree directive for rst file.

Parameters:
  • conf_path – conf.py file absolute path
  • docname – the rst file relpath from conf.py directory.
  • source – rst content.
  • maxdepth – int, max toc tree depth.