add: style
This commit is contained in:
parent
2018c7e3a2
commit
9d297fca7f
@ -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>
|
7
main.py
7
main.py
@ -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()
|
Loading…
Reference in New Issue
Block a user