diff --git a/gen_index.py b/gen_index.py new file mode 100644 index 0000000..81c2eed --- /dev/null +++ b/gen_index.py @@ -0,0 +1,49 @@ +import os +import frontmatter +from jinja2 import Environment, FileSystemLoader +from datetime import datetime # Import datetime + + +def generate_rfc_page(): + """ + Generates an HTML page listing RFC documents using Jinja2 templating. + """ + + rfcs = [] + for root, _, files in os.walk("source/"): + for file in files: + if file.endswith(".md"): + filepath = os.path.join(root, file) + with open(filepath, "r") as f: + post = frontmatter.load(f) + # Get last modified date of the file + last_modified = os.path.getmtime(filepath) + rfcs.append( + { + "title": post.get("title"), + "abstract": post.get("abstract"), + "sotd": post.get("sotd"), + "shortName": post.get("shortName"), + "editor": post.get("editor"), + "link": filepath.replace("source/", "rfcs/").replace( + ".md", ".html" + ), + "updated": datetime.fromtimestamp(last_modified).strftime( + "%B %d, %Y" + ), + } + ) + + # Setup Jinja2 environment + env = Environment(loader=FileSystemLoader(".")) + template = env.get_template("index_template.html") + + # Render the template with the RFC data + html = template.render(rfcs=rfcs) + + with open("index.html", "w") as f: + f.write(html) + + +if __name__ == "__main__": + generate_rfc_page() diff --git a/index.html b/index.html index 159ce2f..792a296 100644 --- a/index.html +++ b/index.html @@ -9,45 +9,60 @@
-Short Name: starknet-stark
+ +State of This Document: draft
+Updated: October 16, 2024
+ + View RFC + +Version: 0.1
-Updated: October 14, 2024
+Short Name: starknet-fri
+ +State of This Document: draft
+Updated: October 16, 2024
View RFCVersion: 0.1
-Updated: October 14, 2024
- Starknet Merkle Tree Polynomial Commitments +Short Name: starknet-commit
+ +State of This Document: none
+Updated: October 16, 2024
+ View RFCVersion: 0.1
-Updated: October 14, 2024
+Short Name: starknet-channel
+ +State of This Document: draft
+Updated: October 16, 2024
View RFC