Add index.html generation.

This commit is contained in:
Sergio Martínez Portela 2022-08-20 13:59:15 +02:00
parent ef1d71dc2f
commit 399f00a54f

View File

@ -20,6 +20,7 @@ EXTENSIONS = [
]
MIN_HIDDEN_HEADLINE_LEVEL = 2
INDEX_ID = "ea48ec1d-f9d4-4fb7-b39a-faa7b6e2ba95"
def load_all(top_dir_relative):
top = os.path.abspath(top_dir_relative)
@ -156,6 +157,12 @@ def main(src_top, dest_top):
f.write(as_document(render(headline, doc, headlineLevel=0)))
files_generated += 1
if headline.id == INDEX_ID:
index_endpath = os.path.join(dest_top, "index.html")
with open(index_endpath, "wt") as f:
f.write(as_document(render(headline, doc, headlineLevel=0)))
files_generated += 1
# Update graph, replace document ids with headline ids
for headline_data in graph.values():
for link in headline_data['links']:
@ -318,6 +325,7 @@ def as_document(html):
return f"""<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href="../static/style.css" rel="stylesheet"/>
<script type="text/javascript">
function toggle_expand(header_id) {{