|
42 | 42 | 'sphinx_linklint.ext', |
43 | 43 | 'notfound.extension', |
44 | 44 | 'sphinxext.opengraph', |
| 45 | + 'sphinxext.rediraffe', |
| 46 | + 'sphinxcontrib.rsvgconverter', |
45 | 47 | ) |
46 | 48 | for optional_ext in _OPTIONAL_EXTENSIONS: |
47 | 49 | try: |
|
74 | 76 | # and replace the values accordingly. |
75 | 77 | # See Doc/tools/extensions/patchlevel.py |
76 | 78 | version, release = get_version_info() |
| 79 | +v = get_header_version_info() |
| 80 | +branch = "main" if v.releaselevel == "alpha" else f"{v.major}.{v.minor}" |
77 | 81 |
|
78 | 82 | rst_epilog = f""" |
79 | 83 | .. |python_version_literal| replace:: ``Python {version}`` |
|
292 | 296 | "repository_url": repository_url or None, |
293 | 297 | "pr_id": os.getenv("READTHEDOCS_VERSION"), |
294 | 298 | "enable_analytics": os.getenv("PYTHON_DOCS_ENABLE_ANALYTICS"), |
| 299 | + "source_branch": branch, |
295 | 300 | } |
296 | 301 |
|
297 | 302 | # This 'Last updated on:' timestamp is inserted at the bottom of every page. |
|
301 | 306 | # Path to find HTML templates to override theme |
302 | 307 | templates_path = ['tools/templates'] |
303 | 308 |
|
| 309 | +# We link to sources on GitHub, so don't copy them into the HTML output. |
| 310 | +html_copy_source = False |
| 311 | + |
304 | 312 | # Custom sidebar templates, filenames relative to this file. |
305 | 313 | html_sidebars = { |
306 | 314 | # Defaults taken from https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_sidebars |
|
356 | 364 | # Grouping the document tree into LaTeX files. List of tuples |
357 | 365 | # (source start file, target name, title, author, document class [howto/manual]). |
358 | 366 | latex_documents = [ |
359 | | - ('c-api/index', 'c-api.tex', 'The Python/C API', _doc_authors, 'manual'), |
| 367 | + ( |
| 368 | + 'c-api/index', |
| 369 | + 'c-api.tex', |
| 370 | + 'The Python/C API', |
| 371 | + _doc_authors, |
| 372 | + 'manual', |
| 373 | + ), |
360 | 374 | ( |
361 | 375 | 'extending/index', |
362 | 376 | 'extending.tex', |
|
371 | 385 | _doc_authors, |
372 | 386 | 'manual', |
373 | 387 | ), |
| 388 | + ( |
| 389 | + 'builtins/index', |
| 390 | + 'builtins.tex', |
| 391 | + 'Python Built-ins Reference', |
| 392 | + _doc_authors, |
| 393 | + 'manual', |
| 394 | + ), |
374 | 395 | ( |
375 | 396 | 'library/index', |
376 | 397 | 'library.tex', |
|
549 | 570 | # Options for sphinx.ext.extlinks |
550 | 571 | # ------------------------------- |
551 | 572 |
|
552 | | -v = get_header_version_info() |
553 | | -branch = "main" if v.releaselevel == "alpha" else f"{v.major}.{v.minor}" |
554 | | - |
555 | 573 | # This config is a dictionary of external sites, |
556 | 574 | # mapping unique short aliases to a base URL and a prefix. |
557 | 575 | # https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html |
|
597 | 615 | '<meta property="og:image:width" content="200">', |
598 | 616 | '<meta property="og:image:height" content="200">', |
599 | 617 | ) |
| 618 | + |
| 619 | +# Options for sphinxext-rediraffe |
| 620 | +# ------------------------------- |
| 621 | + |
| 622 | +rediraffe_redirects = { |
| 623 | + # Splitting builtins from library |
| 624 | + "library/functions.rst": "builtins/functions.rst", |
| 625 | + "library/stdtypes.rst": "builtins/stdtypes.rst", |
| 626 | + "library/constants.rst": "builtins/constants.rst", |
| 627 | + "library/exceptions.rst": "builtins/exceptions.rst", |
| 628 | +} |
0 commit comments