Modify HTML via build.jobs.post_buildΒΆ

Modify the content of the HTML in build.jobs.post_build by replacing some text using sed. Test case for https://github.com/readthedocs/readthedocs.org/issues/9179

Note

This text should say something different than a placesholder:

$This text has been modified by sed


 1version: 2
 2
 3build:
 4  os: ubuntu-22.04
 5  jobs:
 6    post_build:
 7      # Modify the HTML content via `build.jobs.post_build` and check if it has effect
 8      - sed -i -e "s|This text has been modified by sed|This text has been modified by sed|g" _readthedocs/html/index.html
 9  tools:
10    python: "3"
11
12sphinx:
13  configuration: docs/conf.py
14
15python:
16  install:
17    - requirements: requirements.txt

Sphinx configuration file used to build this docs (see full file),

 1# -*- coding: utf-8 -*-
 2
 3# Default settings
 4project = 'Test Builds'
 5extensions = [
 6    'sphinx_autorun',
 7]
 8
 9latex_engine = 'xelatex'  # allow us to build Unicode chars
10
11
12# Include all your settings here
13html_theme = 'sphinx_rtd_theme'
14
15
16
17

>>> # Build at
>>> import datetime
>>> datetime.datetime.utcnow()  # UTC
datetime.datetime(2023, 1, 24, 17, 16, 58, 852000)