Skip to content

Commit

Permalink
Add direct media links
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelLerchner committed Jan 30, 2024
1 parent 161ee86 commit 5d75bd8
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 57 deletions.
13 changes: 9 additions & 4 deletions html-renderer/render_to_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,27 @@ def render_content():
for file in sorted(os.listdir(sheet + "/submission")):
full_path = sheet + "/submission/" + file

media_id = sheet + "#" + file

if file.endswith(".png"):
media = content_template

media = media.replace(
"###MEDIA###", "<img src='" + full_path + "'/>")
"###MEDIA###", "<img id=" + media_id + " src='" + full_path + "'/>")

media = media.replace("###MEDIA_ID###", sheet + "#" + file)

media = media.replace("###SUBTITLE###", file)
media = media.replace(
"###SUBTITLE###", "<a href='#" + media_id + "'>" + file + "</a>")

media_wall += media
elif file.endswith(".mp4"):
media = content_template

media = media.replace(
"###MEDIA###", "<video controls muted><source src='" + full_path + "' type='video/mp4'></video>")
"###MEDIA###", "<video id=" + media_id+" controls muted><source src='" + full_path + "' type='video/mp4'></video>")

media = media.replace("###SUBTITLE###", file)
media = media.replace("###SUBTITLE###", "<a href='#" + media_id + "'>" + file + "</a>")

media_wall += media
elif file.endswith(".pdf") or file.endswith(".md"):
Expand Down
Loading

0 comments on commit 5d75bd8

Please sign in to comment.