NixNet/py/main.py

26 lines
612 B
Python
Raw Normal View History

import json
2019-07-14 03:50:04 +00:00
with open('json/cards.json') as f:
x = json.load(f)
text = ""
for i in x["cards"]:
text += f"""
<div class="card">
<h1>{i["name"]}</h1>
<p>{i["description"]}</p>
2021-06-11 00:03:02 +00:00
<div class="buttons">
<a href="{i["link"]}"><button class="button">{i["button_text"]}</button></a>
"""
if i["tor"] != "#":
text += f'<a href="{i["tor"]}"><button class="tor">Tor</button></a>'
2021-06-11 00:03:02 +00:00
text += "</div></div>"
with open('_site/index.html') as f:
y = f.read()
2019-03-23 18:05:23 +00:00
y = y.replace('<!-- Static cards -->', text)
with open('_site/index.html', 'w') as f:
f.write(y)