|
114 | 114 | # Short title used e.g. for <title> HTML tags. |
115 | 115 | html_short_title='%s Documentation'%release |
116 | 116 |
|
117 | | -# Deployment preview information, from Netlify |
118 | | -# (See netlify.toml and https://docs.netlify.com/configure-builds/environment-variables/#git-metadata) |
| 117 | +# Deployment preview information |
| 118 | +# (See .readthedocs.yml and https://docs.readthedocs.io/en/stable/reference/environment-variables.html) |
| 119 | +repository_url=os.getenv("READTHEDOCS_GIT_CLONE_URL") |
119 | 120 | html_context= { |
120 | | -"is_deployment_preview":os.getenv("IS_DEPLOYMENT_PREVIEW"), |
121 | | -"repository_url":os.getenv("REPOSITORY_URL"), |
122 | | -"pr_id":os.getenv("REVIEW_ID") |
| 121 | +"is_deployment_preview":os.getenv("READTHEDOCS_VERSION_TYPE")=="external", |
| 122 | +"repository_url":repository_url.removesuffix(".git")ifrepository_urlelseNone, |
| 123 | +"pr_id":os.getenv("READTHEDOCS_VERSION") |
123 | 124 | } |
124 | 125 |
|
125 | 126 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, |
|
263 | 264 |
|
264 | 265 | linkcheck_allowed_redirects= { |
265 | 266 | # bpo-NNNN -> BPO -> GH Issues |
266 | | -r'https://bugs.python.org/issue\?@action=redirect&bpo=\d+':'https://github.com/python/cpython/issues/\d+', |
| 267 | +r'https://bugs.python.org/issue\?@action=redirect&bpo=\d+':r'https://github.com/python/cpython/issues/\d+', |
267 | 268 | # GH-NNNN used to refer to pull requests |
268 | | -r'https://github.com/python/cpython/issues/\d+':'https://github.com/python/cpython/pull/\d+', |
| 269 | +r'https://github.com/python/cpython/issues/\d+':r'https://github.com/python/cpython/pull/\d+', |
269 | 270 | # :source:`something` linking files in the repository |
270 | | -r'https://github.com/python/cpython/tree/.*':'https://github.com/python/cpython/blob/.*' |
| 271 | +r'https://github.com/python/cpython/tree/.*':'https://github.com/python/cpython/blob/.*', |
| 272 | +# Intentional HTTP use at Misc/NEWS.d/3.5.0a1.rst |
| 273 | +r'http://www.python.org/$':'https://www.python.org/$', |
| 274 | +# Used in license page, keep as is |
| 275 | +r'https://www.zope.org/':r'https://www.zope.dev/', |
| 276 | +# Microsoft's redirects to learn.microsoft.com |
| 277 | +r'https://msdn.microsoft.com/.*':'https://learn.microsoft.com/.*', |
| 278 | +r'https://docs.microsoft.com/.*':'https://learn.microsoft.com/.*', |
| 279 | +r'https://go.microsoft.com/fwlink/\?LinkID=\d+':'https://learn.microsoft.com/.*', |
| 280 | +# Language redirects |
| 281 | +r'https://toml.io':'https://toml.io/en/', |
| 282 | +r'https://www.redhat.com':'https://www.redhat.com/en', |
| 283 | +# Other redirects |
| 284 | +r'https://www.boost.org/libs/.+':r'https://www.boost.org/doc/libs/\d_\d+_\d/.+', |
| 285 | +r'https://support.microsoft.com/en-us/help/\d+':'https://support.microsoft.com/en-us/topic/.+', |
| 286 | +r'https://perf.wiki.kernel.org$':'https://perf.wiki.kernel.org/index.php/Main_Page', |
| 287 | +r'https://www.sqlite.org':'https://www.sqlite.org/index.html', |
| 288 | +r'https://mitpress.mit.edu/sicp$':'https://mitpress.mit.edu/9780262510875/structure-and-interpretation-of-computer-programs/', |
| 289 | +r'https://www.python.org/psf/':'https://www.python.org/psf-landing/', |
271 | 290 | } |
272 | 291 |
|
273 | 292 | linkcheck_anchors_ignore= [ |
|