jinja enters the stage

main
mb 2 years ago
parent 1e1eed56c1
commit 01a4d22c84

@ -1,6 +1,7 @@
from glob import glob from glob import glob
import os import os
import subprocess import subprocess
import jinja2
# https://devdocs.io/python~3.9/library/glob#glob.glob # https://devdocs.io/python~3.9/library/glob#glob.glob
# files = glob("content/**", recursive=True) # files = glob("content/**", recursive=True)
@ -55,6 +56,12 @@ pandoc_md = "pandoc -s --toc -c style.css -f markdown -t html booklet.md -o book
os.system(pandoc_md) os.system(pandoc_md)
print("booklet html files saved!") print("booklet html files saved!")
html=[]
env = jinja2.Environment(loader=jinja2.FileSystemLoader("."))
template = env.get_template("booklet.template.html")
booklet_html = template.render(content=html)
#take all the css files and write to main css #take all the css files and write to main css

@ -1,22 +1,13 @@
<!DOCTYPE html> <DOCTYPE html>
<html lang="$language$"> <html>
<head> <head>
<title></title>
<meta charset="utf-8"> <meta charset="utf-8">
<title>$title$</title> <script src="paged.js/paged.polyfill.js"></script>
<script src="paged.js/paged.polyfill.js" type="text/javascript"></script>
<link href="paged.js/pagedjs.css" rel="stylesheet" type="text/css"> <link href="paged.js/pagedjs.css" rel="stylesheet" type="text/css">
<link href="print.css" rel="stylesheet" type="text/css" media="print"> <link rel="stylesheet" type="text/css" href="stylesheet.css">
</head> </head>
<body> <body>
<div id="content">{{ content }}</div>
<h1 id="title">$title$</h1>
$if(toc)$
<section id="toc" role="doc-toc">$table-of-contents$</section>
$endif$
<div id="container">$body$</div>
</body> </body>
</html> </html>
Loading…
Cancel
Save