You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
576 B
25 lines
576 B
4 years ago
|
import json
|
||
|
|
||
4 years ago
|
with open('json/cards.json') as f:
|
||
4 years ago
|
x = json.load(f)
|
||
|
|
||
|
text = ""
|
||
|
for i in x["cards"]:
|
||
|
text += f"""
|
||
|
<div class="card">
|
||
|
<h1>{i["name"]}</h1>
|
||
|
<p>{i["description"]}</p>
|
||
|
<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>'
|
||
|
|
||
|
text += "</div>"
|
||
|
|
||
|
with open('_site/index.html') as f:
|
||
|
y = f.read()
|
||
|
|
||
4 years ago
|
y = y.replace('<!-- Static cards -->', text)
|
||
4 years ago
|
with open('_site/index.html', 'w') as f:
|
||
|
f.write(y)
|