Skip to content

Commit

Permalink
Update dates (and formatting apparently)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericthelemur committed Oct 29, 2023
1 parent 01cb848 commit 84bc3d6
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 41 deletions.
49 changes: 31 additions & 18 deletions build.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import os
import sys
import shutil
import sys

import markdown
from jinja2 import Environment, FileSystemLoader, Template

rendered_content = dict()

rendered_content["event_year"] = "2023" # e.g. "2022" or "Summer 2021"
rendered_content["event_start_date"] = "11th Feb 2023"
rendered_content["subs_close_date"] = "9th Jan"
rendered_content["sub_close_time"] = "2023-01-09T23:59:00Z"
rendered_content["countdown_time"] = "2023-02-11T10:15:00Z"
rendered_content["end_time"] = "2023-02-12T19:00:00Z"
rendered_content["event_date_range"] = "11-12th Feb 2023"
rendered_content["signup_link"] = "https://oengus.fun/wasd2023"
rendered_content["event_year"] = "2024" # e.g. "2022" or "Summer 2021"
rendered_content["event_start_date"] = "3rd Feb 2024"
rendered_content["subs_close_date"] = "8th Jan"
rendered_content["sub_close_time"] = "2024-01-08T23:59:00Z"
rendered_content["countdown_time"] = "2024-02-03T10:00:00Z"
rendered_content["end_time"] = "2024-02-14T19:00:00Z"
rendered_content["event_date_range"] = "3-4th Feb 2024"
rendered_content["signup_link"] = "https://oengus.fun/wasd2024"
rendered_content["money_raised"] = "£9,000"

env = Environment(
Expand All @@ -28,15 +28,24 @@
if (md := file_name.endswith(".md")) or file_name.endswith(".html"):
with open(os.path.join(base, file_name)) as file:
content_md = file.read()
if md: content_html = markdown.markdown(content_md, extensions=['extra'])
else: content_html = content_md
if md:
content_html = markdown.markdown(content_md, extensions=["extra"])
else:
content_html = content_md

rendered_content[
file_name.removesuffix(".md" if md else ".html")
] = content_html

rendered_content[file_name.removesuffix(".md" if md else ".html")] = content_html

# SVG Asset injection
def svg_inject(placeholder, filename, ext=".svg"):
if not filename.endswith(ext): filename += ext
rendered_content[placeholder] = open(os.path.join("src", "svg", filename), "r").read()
if not filename.endswith(ext):
filename += ext
rendered_content[placeholder] = open(
os.path.join("src", "svg", filename), "r"
).read()


svg_inject("wasd_keys_logo", "wasd-keys")
svg_inject("stopwatch_svg", "stopwatch")
Expand All @@ -52,24 +61,28 @@ def svg_inject(placeholder, filename, ext=".svg"):
# Load the JS for injection into the template
rendered_content["javascript"] = open(os.path.join("src", "js", "site.js"), "r").read()

if os.path.exists("build"):
if os.path.exists("build"):
shutil.rmtree("build")
os.makedirs("build")

for file_name in os.listdir("templates"):
if os.path.isdir(os.path.join("templates", file_name)): continue
if os.path.isdir(os.path.join("templates", file_name)):
continue
with open(os.path.join("build", file_name), mode="w") as out_file:
# Recursive render
jinja_template = env.get_template(file_name)
content = jinja_template.render(**rendered_content)
while True:
new_content = Template(content).render(**rendered_content)
if new_content == content: break
if new_content == content:
break
content = new_content

# Remove development mode content from the template
if not dev_flag:
content = content.replace('http://localhost:8080', 'https://warwickspeed.run')
content = content.replace(
"http://localhost:8080", "https://warwickspeed.run"
)

out_file.write(content)

Expand Down
2 changes: 1 addition & 1 deletion content/partners_list.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="logos" markdown="span">
[{{ uwcs_dots_svg }}](https://uwcs.co.uk)
[{{ esports_svg }}](https://warwickesports.com/)
<!-- [{{ esports_svg }}](https://warwickesports.com/) -->
[{{ esports_centre_svg }}](https://warwick.ac.uk/esports)
[{{ su_svg }}](https://warwicksu.com)
</div>
44 changes: 22 additions & 22 deletions content/timeline_line.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<h4 class="title is-size-4">Timeline</h4>
<div id="timeline-div">
<ul class="timeline" id="timeline">
<li class="tl-elem phase-sub complete">
<div class="timestamp">7th Dec</div>
<div class="status">Submissions Open</div>
</li>
<li class="tl-elem phase-sub-closed">
<div class="timestamp">9th Jan</div>
<div class="status">Submissions Close</div>
</li>
<li class="tl-elem">
<div class="timestamp">11th Jan</div>
<div class="status">Runs Accepted</div>
</li>
<li class="tl-elem phase-schedule phase-before">
<div class="timestamp">15th Jan</div>
<div class="status">Schedule Released</div>
</li>
<li class="tl-elem phase-during phase-ended">
<div class="timestamp">11-12th Feb</div>
<div class="status">WASD!</div>
</li>
</ul>
<ul class="timeline" id="timeline">
<li class="tl-elem phase-sub complete">
<div class="timestamp">Now</div>
<div class="status">Submissions Open</div>
</li>
<li class="tl-elem phase-sub-closed">
<div class="timestamp">8th Jan</div>
<div class="status">Submissions Close</div>
</li>
<li class="tl-elem">
<div class="timestamp">~12th Jan</div>
<div class="status">Runs Accepted</div>
</li>
<li class="tl-elem phase-schedule phase-before">
<div class="timestamp">~15th Jan</div>
<div class="status">Schedule Released</div>
</li>
<li class="tl-elem phase-during phase-ended">
<div class="timestamp">3-4th Feb</div>
<div class="status">WASD!</div>
</li>
</ul>
</div>

0 comments on commit 84bc3d6

Please sign in to comment.