ReadTheDocs 传单菜单中不会生成自定义 PDF

问题描述 投票:0回答:1

这是我的

.readthedocs.yml
文件,其中包含从 simple-pdf 扩展 构建 PDF 的命令。虽然构建成功执行了所有命令,但我在传单菜单中看不到 PDF。

# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

#submodules:
#  include:
#    - paamr-deployment

# Set the version of Python and other tools you might need
build:
  os: ubuntu-20.04
  tools:
    python: "3.9"
    # You can also specify other tool versions:
    # nodejs: "16"
    # rust: "1.55"
    # golang: "1.17"
  #Add custom simple-pdf to readthedocs flyer menu
    commands:
    - pip install -r docs/requirements.txt
    - rm -rf _readthedocs/pdf
    - mkdir -p _readthedocs/pdf
    - sphinx-build -b simplepdf docs _readthedocs/pdf
    - find _readthedocs/pdf -type f ! -name '*.pdf' -delete  # Delete all files except .pdf
    - find _readthedocs/pdf -mindepth 1 -type d -delete  # Delete all directories except .pdf
    - mkdir -p _readthedocs/html/
    - sphinx-build -b html docs _readthedocs/html

# Build documentation in the docs/ directory with Sphinx
sphinx:
  configuration: docs/conf.py

# If using Sphinx, optionally build your docs in additional formats such as PDF
formats: all

# Optionally declare the Python requirements required to build your docs
python:
  install:
    - requirements: docs/requirements.txt

输出:

  • 阅读文档 PR 构建已通过
  • 激活版构建通过
  • 单击 readthedocs 传单上的 PDF 选项时,显示 404

预期输出:

  • 阅读文档 PR 构建通行证
  • 激活版本构建通道
  • 单击 readthedocs 传单上的 PDF 选项后,应下载 PDF
python python-sphinx read-the-docs
1个回答
0
投票

我能够使用 readthedocs.yaml 文件中的以下命令将自定义 PDF 上传到 readthedocs 传单。

# rest of the yaml code
...
#Upload custom simple-pdf to readthedocs flyer menu
  commands:
    - pip install -r docs/requirements.txt
    - rm -rf _readthedocs/pdf
    - mkdir -p _readthedocs/pdf
    - sphinx-build -b simplepdf docs _readthedocs/pdf
    - find _readthedocs/pdf -type f ! -name '*.pdf' -delete  # Delete all files except .pdf
    - find _readthedocs/pdf -mindepth 1 -type d -delete  # Delete all directories except .pdf
    - mkdir -p _readthedocs/html/
    - sphinx-build -b html docs _readthedocs/html
    - mv _readthedocs/pdf/*.pdf _readthedocs/pdf/$READTHEDOCS_PROJECT.pdf  # Rename the pdf

感谢您的回复和支持。

© www.soinside.com 2019 - 2024. All rights reserved.