File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7777# and replace the values accordingly.
7878# See Doc/tools/extensions/patchlevel.py
7979version , release = get_version_info ()
80+ v = get_header_version_info ()
81+ branch = "main" if v .releaselevel == "alpha" else f"{ v .major } .{ v .minor } "
8082
8183rst_epilog = f"""
8284.. |python_version_literal| replace:: ``Python { version } ``
297299 "repository_url" : repository_url or None ,
298300 "pr_id" : os .getenv ("READTHEDOCS_VERSION" ),
299301 "enable_analytics" : os .getenv ("PYTHON_DOCS_ENABLE_ANALYTICS" ),
302+ "source_branch" : branch ,
300303}
301304
302305# This 'Last updated on:' timestamp is inserted at the bottom of every page.
560563# Options for sphinx.ext.extlinks
561564# -------------------------------
562565
563- v = get_header_version_info ()
564- branch = "main" if v .releaselevel == "alpha" else f"{ v .major } .{ v .minor } "
565-
566566# This config is a dictionary of external sites,
567567# mapping unique short aliases to a base URL and a prefix.
568568# https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html
Original file line number Diff line number Diff line change @@ -19,13 +19,13 @@ <h3>{{ _('This page') }}</h3>
1919 < li > < a href ="{{ pathto('bugs') }} "> {% trans %}Report a bug{% endtrans %}</ a > </ li >
2020 < li > < a class ="improvepage " href ="{{ pathto('improve-page-nojs') }} "> {% trans %}Improve this page{% endtrans %}</ a > </ li >
2121 < li >
22- < a href ="https://github.com/python/cpython/blob/main /Doc/{{ pagename }}.rst?plain=1 "
22+ < a href ="https://github.com/python/cpython/blob/{{ source_branch }} /Doc/{{ pagename }}.rst?plain=1 "
2323 rel ="nofollow "> {{ _('Show source') }}
2424 </ a >
2525 </ li >
26- {% if language != "en" %}
26+ {% if language != "en" and source_branch != "main" %}
2727 < li >
28- < a href ="https://github.com/python/python-docs-{{ language }}/blob/{{ version }}/{{ pagename }}.po?plain=1 "
28+ < a href ="https://github.com/python/python-docs-{{ language | replace('_', '-') | lower }}/blob/{{ source_branch }}/{{ pagename }}.po?plain=1 "
2929 rel ="nofollow "> {{ _('Show translation source') }}</ a >
3030 </ li >
3131 {% endif %}
You can’t perform that action at this time.
0 commit comments