From 22fa9562fd8b227ef438fbfb0e81a7b3ad07a00c Mon Sep 17 00:00:00 2001 From: Thomas Beutlich Date: Tue, 6 Apr 2021 20:12:19 +0200 Subject: [PATCH] refs #2404: Update specification.modelica.org landing page * Copy layout from doc.modelica.org * Provide search (powered by algolia) --- .CI/index.py | 143 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 139 insertions(+), 4 deletions(-) diff --git a/.CI/index.py b/.CI/index.py index c102dc325..eda6d1a1d 100644 --- a/.CI/index.py +++ b/.CI/index.py @@ -2,10 +2,145 @@ import xml.etree.ElementTree as ET xml = "" + markdown.markdown(open('README.md', encoding="utf-8").read(), extensions=['markdown.extensions.tables']) + "" root = ET.fromstring(xml) +head = """ + + + + + Modelica Specification + + + + + + +
+

Modelica Specification

+""" +tail = """
+ +
+ + + +
+
+ + + + + + + + +""" for elem in root.findall('.//table'): - f = open("index.html", "w") - f.write("") - f.write(ET.tostring(elem).decode('utf-8')) - f.write("") + with open("index.html", "w") as f: + f.write(head) + f.write(ET.tostring(elem).decode('utf-8')) + f.write(tail) sys.exit(0) sys.exit(1)