Skip to content

Commit

Permalink
feat(devtools): split up courses.html in preparation for the history.…
Browse files Browse the repository at this point in the history
…html
  • Loading branch information
szabgab committed Jan 15, 2022
1 parent a6dc4d6 commit ab2c8bb
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 23 deletions.
7 changes: 6 additions & 1 deletion apps/tools/librelingo_tools/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ def generate_html(start_time, end_time, links, outdir):
templates_dir = os.path.join(root, "templates")
env = Environment(loader=FileSystemLoader(templates_dir), autoescape=True)
template = env.get_template("courses.html")
html = template.render(start_time=start_time, end_time=end_time, links=links)
html = template.render(
start_time=start_time,
end_time=end_time,
links=links,
title="LibreLingo courses",
)

with open(os.path.join(outdir, "index.html"), "w") as fh:
fh.write(html)
Expand Down
2 changes: 2 additions & 0 deletions apps/tools/librelingo_tools/templates/central/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
</body>
</html>
21 changes: 21 additions & 0 deletions apps/tools/librelingo_tools/templates/central/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
<head>
<title>{{ title }}</title>
<style>
.odd {
background-color: #EEEEEE;
}
.even {
background-color: #FFFFFF;
}
.warning {
background-color: #FF5555;
}
</style>
</head>
<body>

25 changes: 3 additions & 22 deletions apps/tools/librelingo_tools/templates/courses.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
<head>
<title>LibreLingo courses</title>
<style>
.odd {
background-color: #EEEEEE;
}
.even {
background-color: #FFFFFF;
}
.warning {
background-color: #FF5555;
}
</style>
</head>
<body>
{% include 'central/header.html' %}

<h1><a href="https://librelingo.app/">LibreLingo courses</a></h1>
<table>
<tr><th>Course</th><th>Target Words</th><th>Target Phrases</th><th>Source Words</th><th>Source Phrases</th></tr>
Expand All @@ -32,6 +14,5 @@ <h1><a href="https://librelingo.app/">LibreLingo courses</a></h1>
{% endfor %}
</table>
<div>Generated at {{ start_time }} Elapsed time: {{ (end_time-start_time).seconds }} seconds</div>
</body>
</html>

{% include 'central/footer.html' %}

0 comments on commit ab2c8bb

Please sign in to comment.