-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenerate_html.py
91 lines (91 loc) · 3.99 KB
/
generate_html.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# creates html from
# txt files in the data folder
import os
from os import listdir
from os.path import isfile, join
onlyfiles = [f for f in listdir(join('consecutive-days', 'data')) if isfile(join('consecutive-days', 'data', f))]
for file in onlyfiles:
fileless = file.split('.')
digitless = fileless[0].split('_')
title = digitless[1]
filePath = join('consecutive-days', fileless[0] + '.html')
with open(filePath,'w') as f:
f.write('<!DOCTYPE html>')
f.write("\n")
f.write(' <html>')
f.write("\n")
f.write(' <head>')
f.write("\n")
f.write(' <meta property="og:url" content="https://vincent.charlebois.info/consecutive-days/" />')
f.write("\n")
f.write(' <meta property="og:title" content="Consecutive days at the studio - Vincent Charlebois 2022" />')
f.write("\n")
f.write(' <meta property="og:description" content="Vincent Charlebois\' timesheet for consecutive days at the studio. ' + title + ' 2022 in Verdun (Montreal, QC Canada)" />')
f.write("\n")
f.write(' <meta property="og:image" content="https://vincent.charlebois.info/consecutive-days/png/all_days.png" />')
f.write("\n")
f.write(' <link rel="stylesheet" href="css/style.css">')
f.write("\n")
f.write(' <meta name="twitter:card" content="summary" />')
f.write("\n")
f.write(' <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1">')
f.write("\n")
f.write(' <title>')
f.write("\n")
f.write(' ' + title)
f.write("\n")
f.write(' </title>')
f.write("\n")
f.write(' <meta')
f.write("\n")
f.write(' name="description"')
f.write("\n")
f.write(' content="Vincent Charlebois\' timesheet for consecutive days at the studio. ' + title + ' 2022 in Verdun (Montreal, QC Canada)"')
f.write("\n")
f.write(' >')
f.write("\n")
f.write(" </head>")
f.write("\n")
f.write(' <body id="dcontain" class="hide-ovflo">')
f.write("\n")
if fileless[0] == "00_All_Days":
f.write(' <div class="flexbox consecutivebox alldays" id="fbox">')
else:
f.write(' <div class="flexbox justify-center consecutivebox" id="fbox">')
f.write("\n")
f.write(' <script type="text/javascript" src="js/bonjourhi.js"></script>')
f.write("\n")
f.write(' <script type="text/javascript" src="js/script.js"></script>')
f.write("\n")
f.write(' <script>')
f.write("\n")
f.write(" document.addEventListener('DOMContentLoaded', syncReadFile('data/")
f.write(fileless[0])
f.write(".txt'));")
f.write("\n")
f.write(" </script>")
f.write("\n")
f.write(" </div>")
#f.write("\n")
#f.write(" </a>")
f.write("\n")
f.write(' <div id="arrow" class="back-arrow">')
f.write("\n")
f.write(' <img')
f.write("\n")
f.write(' src="png/back-arrow.png"')
f.write("\n")
f.write(' alt="back arrow"')
f.write("\n")
f.write(' onClick="arrowButton()"')
f.write("\n")
f.write(' role="button"')
f.write("\n")
f.write(' tabIndex="0">')
f.write("\n")
f.write(" </div>")
f.write("\n")
f.write(" </body>")
f.write("\n")
f.write(" </html>")
print('created ' + fileless[0] + '.html')