cpython/Doc/tools/templates/customsourcelink.html
Miss Islington (bot) 362839671e
[3.15] gh-157517: Don't copy HTML sources and fix sidebar sources links in docs builds (GH-157522) (#157567)
Co-authored-by: Maciej Olko <maciej.olko@affirm.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-09-15 16:02:16 +00:00

34 lines
1.5 KiB
HTML

{%- if page_source_suffix is defined %}
<script>
document.addEventListener('DOMContentLoaded', () => {
const title = document.querySelector('meta[property="og:title"]').content;
const elements = document.querySelectorAll('.improvepage');
const pageurl = window.location.href.split('?')[0];
elements.forEach(element => {
const url = new URL(element.href.split('?')[0].replace("-nojs", ""));
url.searchParams.set('pagetitle', title);
url.searchParams.set('pageurl', pageurl);
url.searchParams.set('pagesource', "{{ pagename }}.rst");
element.href = url.toString();
});
});
</script>
<div role="note" aria-label="source link">
<h3>{{ _('This page') }}</h3>
<ul class="this-page-menu">
<li><a href="{{ pathto('bugs') }}">{% trans %}Report a bug{% endtrans %}</a></li>
<li><a class="improvepage" href="{{ pathto('improve-page-nojs') }}">{% trans %}Improve this page{% endtrans %}</a></li>
<li>
<a href="https://github.com/python/cpython/blob/{{ source_branch }}/Doc/{{ pagename }}.rst?plain=1"
rel="nofollow">{{ _('Show source') }}
</a>
</li>
{% if language != "en" and source_branch != "main" %}
<li>
<a href="https://github.com/python/python-docs-{{ language | replace('_', '-') | lower }}/blob/{{ source_branch }}/{{ pagename }}.po?plain=1"
rel="nofollow">{{ _('Show translation source') }}</a>
</li>
{% endif %}
</ul>
</div>
{%- endif %}