mirror of
https://github.com/koodiklinikka/palkkakysely.git
synced 2026-03-19 21:06:01 +00:00
Add full generation pipeline
This commit is contained in:
26
massage_templates.py
Normal file
26
massage_templates.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import datetime
|
||||
import glob
|
||||
import os
|
||||
|
||||
import jinja2
|
||||
|
||||
|
||||
def main():
|
||||
env = jinja2.Environment(
|
||||
autoescape=True,
|
||||
)
|
||||
data = {
|
||||
"date": datetime.datetime.utcnow(),
|
||||
}
|
||||
for filename in glob.glob("template/*"):
|
||||
out_filename = os.path.join("out", os.path.relpath(filename, "template"))
|
||||
with open(filename, "r") as inf:
|
||||
tpl: jinja2.Template = env.from_string(inf.read())
|
||||
content = tpl.render(data)
|
||||
with open(out_filename, "w") as outf:
|
||||
outf.write(content)
|
||||
print(filename, "=>", out_filename)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user