Skip to content

Commit b250f03

Browse files
committed
Render language data
1 parent ba1be15 commit b250f03

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

generate.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ def get_project_data(
5858
built = language.code in languages_built
5959
if repo:
6060
stats, translators_data, branch, change = get_stats(clones_dir, repo)
61+
62+
template = Template(Path('language.html.jinja').read_text())
63+
Path(f'{language.code}.html').write_text(
64+
template.render(stats=stats, language=language)
65+
)
6166
else:
6267
stats = SimpleNamespace(completion=0.0)
6368
translators_data = TranslatorsData(0, False)

language.html.jinja

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<html lang="en">
2+
<head>
3+
<title>Python Docs Translation Dashboard</title>
4+
<link rel="stylesheet" href="style.css">
5+
<meta charset="UTF-8">
6+
<meta name="description" content="Python Docs Translation Dashboard">
7+
<base target="_blank">
8+
</head>
9+
<body>
10+
<h1>Python Docs Translation Dashboard: {{ language.name }}</h1>
11+
<nav class="switchpages">
12+
<a href="index.html" target="_self">main</a> | <a href="metadata.html" target="_self">meta</a>
13+
</nav>
14+
<table>
15+
<thead>
16+
<tr>
17+
<th>path</th>
18+
<th>completion</th>
19+
</tr>
20+
</thead>
21+
<tbody>
22+
{% for directory in stats.stats_by_directory() %}
23+
<tr>
24+
<td>{{ directory.path.stem }}</td>
25+
<td data-label="completion">
26+
<div class="progress-bar" style="width: {{ directory.completion }}%;background-color: #4caf50;">
27+
{{ '{:.2f}%'.format(directory.completion) }}
28+
</div>
29+
<div class="progress-bar-outer-label">
30+
{{ '{:.2f}%'.format(directory.completion) }}
31+
</div>
32+
</td>
33+
</tr>
34+
{% endfor %}
35+
</tbody>
36+
</table>
37+
</body>
38+
<script>
39+
function updateProgressBarVisibility() {
40+
document.querySelectorAll('.progress-bar').forEach(progressBar => {
41+
const barWithOverflowWidth = progressBar.scrollWidth;
42+
const barWidth = progressBar.clientWidth;
43+
44+
if (barWidth < barWithOverflowWidth) {
45+
progressBar.classList.add('low');
46+
} else {
47+
progressBar.classList.remove('low');
48+
}
49+
});
50+
}
51+
52+
updateProgressBarVisibility();
53+
54+
window.addEventListener('resize', updateProgressBarVisibility);
55+
</script>
56+
</html>

0 commit comments

Comments
 (0)