add: style

This commit is contained in:
starnakin 2024-08-05 21:37:29 +02:00
parent 2018c7e3a2
commit 9d297fca7f
3 changed files with 11 additions and 4 deletions

View File

@ -2,11 +2,14 @@
<head> <head>
<title>My Readings</title> <title>My Readings</title>
<style>
{{style}}
</style>
</head> </head>
<body> <body>
<h1>My Readings</h1> <h1>My Readings</h1>
<table id="table"> <table id="table">
{{}} {{books}}
</table> </table>
</body> </body>

View File

@ -3,9 +3,10 @@ from Book import Book
# Opening JSON file # Opening JSON file
f = open('constructor.json', encoding='utf-8') f = open('constructor.json', encoding='utf-8')
data = json.load(f) data = json.load(f)
f.close()
f = open("style.css")
style = f.read()
f.close() f.close()
books = data['books'] books = data['books']
@ -16,5 +17,5 @@ for book_data in books:
html += book.to_html() html += book.to_html()
f = open("cast.html") f = open("cast.html")
print(f.read().replace("{{}}", html)) print(f.read().replace("{{books}}", html).replace("{{style}}", style))
f.close() f.close()

3
style.css Normal file
View File

@ -0,0 +1,3 @@
body{
background-color: #586e75;
}