-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_index_with_charts.py
More file actions
42 lines (33 loc) · 1.25 KB
/
update_index_with_charts.py
File metadata and controls
42 lines (33 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""
Update index.html to include benchmark visualizations inline.
This ensures the charts work even without Jekyll includes.
"""
import re
import os
def update_index_html():
"""Update index.html to include benchmark charts inline."""
# Read current index.html
with open('index.html', 'r') as f:
content = f.read()
# Check if benchmark charts exist
charts_path = '_includes/benchmark_charts.html'
if os.path.exists(charts_path):
with open(charts_path, 'r') as f:
charts_html = f.read()
# Replace the placeholder with actual charts
placeholder = r'<div id="benchmark-charts-container"></div>.*?</script>'
replacement = f'<div id="benchmark-charts-container">{charts_html}</div>'
content = re.sub(
r'<div id="benchmark-charts-container"></div>\s*<script>.*?</script>',
replacement,
content,
flags=re.DOTALL
)
print("✅ Updated index.html with benchmark charts")
else:
print("⚠️ Benchmark charts not found, keeping placeholder")
# Write updated content
with open('index.html', 'w') as f:
f.write(content)
if __name__ == '__main__':
update_index_html()