【问题标题】:RTD compiles all my docs including foreign docs from git submodulesRTD 编译我所有的文档,包括来自 git 子模块的外国文档
【发布时间】:2016-05-16 20:07:18
【问题描述】:

我正在尝试使用 SphinxReadTheDocs (RTD) 在每次 GitHub 推送时编译我的文档。不幸的是,RTD 发现了多个包含 conf.py 文件的 doc/docs 文件夹。

我的repository 使用 git 子模块来嵌入第三方库。其中一些还使用 Sphinx 进行了记录。我假设最大(持久的文档构建)获胜并覆盖最终 RTD 视图中的所有静态 HTML 页面。

如何排除或告诉 RTD 忽略这些子模块的文件夹:

lib/cocotb
lib/osvvm
lib/vunit
docs/source/_themes/sphinx_rtd_theme

我的文档位于此处:

docs/source/conf.py
docs/source/index.rst

据我所知,RTD 确实支持*.yml 文件,但没有定义文档根文件夹的条目。

有什么想法可以解决我的问题吗?

【问题讨论】:

    标签: python-sphinx git-submodules read-the-docs


    【解决方案1】:

    conf.py里面,有一个这样的列表

     # List of patterns, relative to source directory, that match files and
     # directories to ignore when looking for source files.
     exclude_patterns = []
    

    你可以把你想忽略的文件放在里面

    exclude_patterns = ["lib/cocotb", "lib/osvvm", "lib/vunit", "docs/_themes/sphinx_rtd_theme"]
    

    请注意,这里的模式是相对于源目录的,你可以把/放在上面每个文件模式的开头,这样更清楚。

    【讨论】:

    • 当我在本地编译我的文档时,这些文件夹不包括在内。从搜索中排除 *.rst 或其他源文件不会阻止 RTD 在整个存储库中找到多个 conf.py 文件。 conf.py 文件位于docs/source。所以这些 lib 目录超出了范围。
    • 你可以尝试在exclude_patterns中指定conf.py的所有相对路径,看看构建时是否还包含这些文件
    【解决方案2】:

    主文档文件夹及其conf.py 可以在每个项目设置的高级设置选项卡中进行配置。

    示例值:documentation/conf.py

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-16
      • 2017-07-19
      • 2015-03-09
      • 1970-01-01
      • 2020-05-26
      相关资源
      最近更新 更多