Boyana 2 years ago
commit 4b8f40d2e4

@ -3,7 +3,6 @@
width: 8.5cm; width: 8.5cm;
height: 8.5cm; height: 8.5cm;
border: solid 1px black; border: solid 1px black;
box-shadow: 5px 5px 0px gray;
float: left; float: left;
margin: 2mm; margin: 2mm;
position: relative; position: relative;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,4 +1,4 @@
<DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title></title> <title></title>
@ -8,6 +8,10 @@
<link rel="stylesheet" type="text/css" href="print_style.css"> <link rel="stylesheet" type="text/css" href="print_style.css">
</head> </head>
<body> <body>
<div id="contenteo">{{ content }}</div> <div id="contenteo">
{% for section in content %}
<section class="section">{{ section }}</section>
{% endfor %}
</div>
</body> </body>
</html> </html>

@ -8,9 +8,7 @@ import jinja2
# print(files) # print(files)
print("---------") print("---------")
all_html = "" all_html = []
all_md = ""
html=[]
folders = glob("*") folders = glob("*")
stoplist = ["00-booklet", "colophon", "spin-wheel"] stoplist = ["00-booklet", "colophon", "spin-wheel"]
@ -31,9 +29,15 @@ for folder in folders:
print("===========") print("===========")
file = file.replace(" ", "\ ") file = file.replace(" ", "\ ")
print(file) print(file)
md_data = open(file).read() md_data = open(file).read()
all_md += "\n"+md_data #all_md += "\n"+md_data
# use pandoc to turn file into html
pandoc_command = "pandoc -f markdown -t html " + file
html_data = subprocess.check_output(pandoc_command, shell=True, text=True,encoding="utf-8")
print("html has been generated!")
all_html.append(html_data)
elif file.endswith((".jpg",".png")): elif file.endswith((".jpg",".png")):
print("image found yay",file) print("image found yay",file)
output_file=file.replace(folder,"./00-booklet") output_file=file.replace(folder,"./00-booklet")
@ -42,30 +46,18 @@ for folder in folders:
print("copied to booklet!",copy_command) print("copied to booklet!",copy_command)
#create booklet.md
output = open("00-booklet/booklet.md", "w")
output.write(all_md)
output.close()
print("booklet md files saved!")
# use pandoc to convert booklet.md to html
pandoc_command = "pandoc --toc -f markdown -t html 00-booklet/booklet.md"
#html_data = subprocess.run(pandoc_command, capture_output=True, text=True).stdout
html_data = subprocess.check_output(pandoc_command, shell=True, text=True,encoding="utf-8")
print("html has been generated!")
#print("html data!", html_data)
#html to template environment #html to template environment
env = jinja2.Environment(loader=jinja2.FileSystemLoader("00-booklet")) env = jinja2.Environment(loader=jinja2.FileSystemLoader("00-booklet"))
template = env.get_template("booklet.template.html") template = env.get_template("booklet.template.html")
booklet_html = template.render(content=html_data) booklet_html = template.render(content=all_html)
#print("this is the html: ", booklet_html) #print("this is the html: ", booklet_html)
output = open("00-booklet/booklet.html", "w") output = open("00-booklet/booklet.html", "w")
output.write(booklet_html) output.write(booklet_html)
output.close() output.close()
print("booklet html files saved!") print("booklet html files saved!")
#take all the css files and write to main css #take all the css files and write to main css

Loading…
Cancel
Save