Add title to rendered notes.

This commit is contained in:
Sergio Martínez Portela 2022-08-20 18:21:26 +02:00
parent f1b84f5615
commit d40b49a027

View File

@ -25,6 +25,7 @@ EXTENSIONS = [
MIN_HIDDEN_HEADLINE_LEVEL = 2
INDEX_ID = "ea48ec1d-f9d4-4fb7-b39a-faa7b6e2ba95"
SITE_NAME = "Código para llevar"
MONITORED_EVENT_TYPES = (
'IN_CREATE',
@ -123,7 +124,7 @@ def regen_all(src_top, dest_top, docs=None):
with open(endpath, "wt") as f:
doc_to_headline_remapping['id:' + doc.id] = 'id:' + main_headline.id
f.write(as_document(render(main_headline, doc, headlineLevel=0)))
f.write(as_document(render(main_headline, doc, headlineLevel=0), headline.title))
files_generated += 1
elif doc.id is not None:
logging.error("Cannot render document from id: {}. {} headlines {} related".format(
@ -175,13 +176,13 @@ def regen_all(src_top, dest_top, docs=None):
}
with open(endpath, "wt") as f:
f.write(as_document(render(headline, doc, headlineLevel=0)))
f.write(as_document(render(headline, doc, headlineLevel=0), headline.title))
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)))
f.write(as_document(render(headline, doc, headlineLevel=0), headline.title))
files_generated += 1
# Update graph, replace document ids with headline ids
@ -386,11 +387,12 @@ def render(headline, doc, headlineLevel):
"""
def as_document(html):
def as_document(html, title):
return f"""<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{title} @ {SITE_NAME}</title>
<link href="../static/style.css" rel="stylesheet"/>
<script type="text/javascript">
function toggle_expand(header_id) {{