fix: support utf-8
This commit is contained in:
parent
65a2adafab
commit
e1d4e4f683
@ -2,6 +2,7 @@
|
||||
|
||||
<head>
|
||||
<title>My Readings</title>
|
||||
<meta charset="UTF-8">
|
||||
<style>
|
||||
{{style}}
|
||||
</style>
|
||||
|
11
main.py
11
main.py
@ -1,6 +1,8 @@
|
||||
import json
|
||||
import sys
|
||||
from Book import Book
|
||||
|
||||
|
||||
# Opening JSON file
|
||||
f = open('constructor.json', encoding='utf-8')
|
||||
data = json.load(f)
|
||||
@ -17,5 +19,12 @@ for book_data in books:
|
||||
html += book.to_html()
|
||||
|
||||
f = open("cast.html")
|
||||
print(f.read().replace("{{books}}", html).replace("{{style}}", style))
|
||||
text = f.read().replace("{{books}}", html).replace("{{style}}", style)
|
||||
f.close()
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
f = open(sys.argv[1], "w", encoding='utf-8')
|
||||
f.write(text)
|
||||
f.close()
|
||||
else:
|
||||
print(text)
|
Loading…
Reference in New Issue
Block a user