Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ body {
margin-top: -4.5px;
}

.nav-link .external-link-icon {
width: 0.75em;
height: 0.75em;
margin: 0 0 0 0.15em;
vertical-align: baseline;
}

.theme-toggle-btn {
border: none;
color: var(--navbar-link-color);
Expand Down
50 changes: 30 additions & 20 deletions templates/base.html.jinja
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!DOCTYPE html>
<html lang="en">
<head>
Expand All @@ -12,7 +12,7 @@
rel="stylesheet"
integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB"
crossorigin="anonymous">
<link href="style.css?version=5" rel="stylesheet">
<link href="style.css?version=6" rel="stylesheet">
</head>
<body>
<script>
Expand Down Expand Up @@ -56,36 +56,46 @@
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="build-details.html">
<svg xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
fill="currentColor"
class="bi bi-card-text"
viewBox="0 0 16 16">
<path d="M14.5 3a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-13a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5zm-13-1A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h13a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 14.5 2z">
</path>
<path d="M3 5.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5M3 8a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9A.5.5 0 0 1 3 8m0 2.5a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5">
</path>
</svg>
Build details
</a>
</li>
<li class="nav-item">
<a class="nav-link"
href="https://devguide.python.org/documentation/translations/translating/"
target="_blank">
Translating
<svg xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
fill="currentColor"
class="bi bi-box-arrow-up-right"
viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5">
class="external-link-icon"
viewBox="0 0 12 12"
aria-hidden="true">
<path d="M7.5 2.5h-5v7h7v-5M6 6l4.5-4.5M7.5 1.5h3v3"
fill="none"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="1.2">
</path>
<path fill-rule="evenodd" d="M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0z">
</svg>
</a>
</li>
<li class="nav-item">
<a class="nav-link"
href="https://discuss.python.org/c/documentation/translations/"
target="_blank"
rel="noopener noreferrer">
Get help
<svg xmlns="http://www.w3.org/2000/svg"
class="external-link-icon"
viewBox="0 0 12 12"
aria-hidden="true">
<path d="M7.5 2.5h-5v7h7v-5M6 6l4.5-4.5M7.5 1.5h3v3"
fill="none"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="1.2">
</path>
</svg>
Translating
</a>
</li>
</ul>
Expand Down
31 changes: 31 additions & 0 deletions tests/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,37 @@ def test_renders(self):
'Measured against the Python 3.15 documentation (prerelease).', index
)

def link_for(href):
link_start = index.index(href)
link_end = index.index('</a>', link_start)
return index[link_start:link_end]

build_details_link = link_for('build-details.html')
self.assertIn('Build details', build_details_link)
self.assertNotIn('<svg', build_details_link)

for href, label in (
(
'https://devguide.python.org/documentation/translations/translating/',
'Translating',
),
(
'https://discuss.python.org/c/documentation/translations/',
'Get help',
),
):
link = link_for(href)
self.assertIn('target="_blank"', link)
self.assertLess(
link.index(label), link.index('class="external-link-icon"')
)
self.assertIn('viewBox="0 0 12 12"', link)
self.assertIn('stroke="currentColor"', link)
self.assertIn(
'rel="noopener noreferrer"',
link_for('https://discuss.python.org/c/documentation/translations/'),
)

def test_orders_by_completion_score(self):
env = Environment(loader=FileSystemLoader('templates'))
language_project_data = generate.LanguageProjectData(
Expand Down
Loading