You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.3 KiB

from glob import glob
import os
import subprocess
import jinja2
# files = glob("content/**", recursive=True)
# print(files)
stoplist = ["print", "colophon"]
folders = glob("*")
for folder in folders:
if folder in stoplist:
files = glob(folder + "/*")
for file in files:
if file.endswith(".md"):
file = file.replace(" ", "\ ")
pandoc2 = "pandoc -f markdown -t html " + file
html_data = subprocess.check_output(pandoc2, shell=True, text=True, encoding="utf-8")
# print(type(html_data))
# print("html_data: ", html_data)
env = jinja2.Environment(loader=jinja2.FileSystemLoader("."))
template = env.get_template("webpage.template.html")
html_data = template.render(content=html_data)
# print("this is the html for ",file,": ", html_data)
output = open(file[:-3] + ".html", "w", encoding="utf-8")
print("standalone index.html file saved!")
#take all the css files and write to main css
# Now open this page in the browser, remember: paged.js needs to be accessed through a webserver.
# To run a webserver locally, you can use:
# cd SI20/booklet/
# python3 -m http.server
# localhost:8000/index.html