|
61 | 61 | ) |
62 | 62 | print(completion_progress[-1]) |
63 | 63 |
|
64 | | -template = Template( |
65 | | - """ |
66 | | -<html lang="en"> |
67 | | -<head> |
68 | | - <title>Python Docs Translation Dashboard</title> |
69 | | - <link rel="stylesheet" href="style.css"> |
70 | | -</head> |
71 | | -<body> |
72 | | -<h1>Python Docs Translation Dashboard</h1> |
73 | | -<table> |
74 | | -<thead> |
75 | | -<tr> |
76 | | - <th>language</th> |
77 | | - <th>build</th> |
78 | | - <th><a href="https://plausible.io/data-policy#how-we-count-unique-users-without-cookies">visitors<a/></th> |
79 | | - <th>translators</th> |
80 | | - <th>completion</th> |
81 | | -</tr> |
82 | | -</thead> |
83 | | -<tbody> |
84 | | -{% for language, repo, completion, translators, visitors, build, in_switcher in completion_progress | sort(attribute='2,3') | reverse %} |
85 | | -<tr> |
86 | | - {% if repo %} |
87 | | - <td data-label="language"> |
88 | | - <a href="https://github.com/{{ repo }}" target="_blank"> |
89 | | - {{ language }} |
90 | | - </a> |
91 | | - </td> |
92 | | - {% else %} |
93 | | - <td data-label="language">{{ language }}</td> |
94 | | - {% endif %} |
95 | | - <td data-label="build"> |
96 | | - {% if build %} |
97 | | - <a href="https://docs.python.org/{{ language }}/" target="_blank">✓{% if in_switcher %} in switcher{% endif %}</a> |
98 | | - {% else %} |
99 | | - ✗ |
100 | | - {% endif %} |
101 | | - </td> |
102 | | - <td data-label="visitors"> |
103 | | - <a href="https://plausible.io/docs.python.org?filters=((contains,page,(/{{ language }}/)))" target="_blank"> |
104 | | - {{ '{:,}'.format(visitors) }} |
105 | | - </a> |
106 | | - </td> |
107 | | - <td data-label="translators">{{ '{:,}'.format(translators) }}</td> |
108 | | - <td data-label="completion"> |
109 | | - <div class="progress-bar" style="width: {{ completion | round(2) }}%;">{{ completion | round(2) }}%</div> |
110 | | - </td> |
111 | | -</tr> |
112 | | -{% endfor %} |
113 | | -</tbody> |
114 | | -</table> |
115 | | -<p>Last updated at {{ generation_time.strftime('%A, %d %B %Y, %X %Z') }}.</p> |
116 | | -</body> |
117 | | -</html> |
118 | | -""" |
119 | | -) |
| 64 | +template = Template(Path('template.html').read_text()) |
120 | 65 |
|
121 | 66 | output = template.render( |
122 | 67 | completion_progress=completion_progress, generation_time=generation_time |
123 | 68 | ) |
124 | 69 |
|
125 | | -with open('index.html', 'w') as file: |
126 | | - file.write(output) |
| 70 | +Path('index.html').write_text(output) |
0 commit comments