Skip to content

Commit fccd677

Browse files
authored
Merge branch 'main' into unit_test_workflow
2 parents 4e2620d + 95524d9 commit fccd677

File tree

2 files changed

+589
-74
lines changed

2 files changed

+589
-74
lines changed
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
# -----------------------------------------------------------------------------
2+
#
3+
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
4+
# SPDX-License-Identifier: BSD-3-Clause
5+
#
6+
# -----------------------------------------------------------------------------
7+
8+
"""Convert pr_report.md to styled HTML."""
9+
10+
import sys
11+
from pathlib import Path
12+
13+
try:
14+
import markdown
15+
except ImportError:
16+
print("Installing markdown library...", file=sys.stderr)
17+
import subprocess
18+
19+
subprocess.check_call([sys.executable, "-m", "pip", "install", "markdown"])
20+
import markdown
21+
22+
23+
def convert_md_to_html(md_file, html_file):
24+
"""Convert markdown to HTML with styling."""
25+
26+
# Read markdown content
27+
with open(md_file, "r", encoding="utf-8") as f:
28+
md_content = f.read()
29+
30+
# Convert markdown to HTML
31+
html_body = markdown.markdown(md_content, extensions=["tables", "fenced_code"])
32+
33+
# Create full HTML document with styling
34+
html_template = f"""<!DOCTYPE html>
35+
<html lang="en">
36+
<head>
37+
<meta charset="UTF-8">
38+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
39+
<title>Open PR Dashboard - quic/efficient-transformers</title>
40+
<style>
41+
* {{
42+
margin: 0;
43+
padding: 0;
44+
box-sizing: border-box;
45+
}}
46+
47+
body {{
48+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
49+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
50+
line-height: 1.6;
51+
color: #24292e;
52+
background-color: #f6f8fa;
53+
padding: 20px;
54+
}}
55+
56+
.container {{
57+
max-width: 1400px;
58+
margin: 0 auto;
59+
background-color: white;
60+
padding: 30px;
61+
border-radius: 8px;
62+
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
63+
}}
64+
65+
h1 {{
66+
color: #1a1a2e;
67+
border-bottom: 3px solid #0366d6;
68+
padding-bottom: 10px;
69+
margin-bottom: 20px;
70+
font-size: 2em;
71+
}}
72+
73+
table {{
74+
width: 100%;
75+
border-collapse: collapse;
76+
margin: 20px 0;
77+
font-size: 0.9em;
78+
overflow-x: auto;
79+
display: block;
80+
}}
81+
82+
thead {{
83+
background-color: #f6f8fa;
84+
position: sticky;
85+
top: 0;
86+
z-index: 10;
87+
}}
88+
89+
th {{
90+
padding: 12px 8px;
91+
text-align: left;
92+
font-weight: 600;
93+
color: #24292e;
94+
border-bottom: 2px solid #d1d5da;
95+
white-space: nowrap;
96+
}}
97+
98+
td {{
99+
padding: 10px 8px;
100+
border-bottom: 1px solid #e1e4e8;
101+
vertical-align: top;
102+
}}
103+
104+
tbody tr:hover {{
105+
background-color: #f6f8fa;
106+
}}
107+
108+
a {{
109+
color: #0366d6;
110+
text-decoration: none;
111+
}}
112+
113+
a:hover {{
114+
text-decoration: underline;
115+
}}
116+
117+
.summary-table {{
118+
width: auto;
119+
margin: 20px 0;
120+
display: table;
121+
}}
122+
123+
.summary-table td {{
124+
padding: 8px 16px;
125+
}}
126+
127+
.summary-table td:first-child {{
128+
font-weight: 600;
129+
color: #586069;
130+
}}
131+
132+
.summary-table td:last-child {{
133+
color: #24292e;
134+
}}
135+
136+
svg {{
137+
display: block;
138+
margin: 20px auto;
139+
}}
140+
141+
/* Status badges */
142+
td:nth-child(5) {{ /* Draft column */
143+
text-align: center;
144+
}}
145+
146+
td:nth-child(4) {{ /* Age column */
147+
text-align: right;
148+
font-variant-numeric: tabular-nums;
149+
}}
150+
151+
/* CI status styling */
152+
td:last-child {{
153+
font-family: 'Courier New', monospace;
154+
font-size: 0.85em;
155+
}}
156+
157+
/* Make PR links bold */
158+
td:first-child a {{
159+
font-weight: 500;
160+
}}
161+
162+
/* Responsive design */
163+
@media (max-width: 1200px) {{
164+
.container {{
165+
padding: 20px;
166+
}}
167+
168+
table {{
169+
font-size: 0.85em;
170+
}}
171+
172+
th, td {{
173+
padding: 8px 6px;
174+
}}
175+
}}
176+
177+
@media print {{
178+
body {{
179+
background-color: white;
180+
}}
181+
182+
.container {{
183+
box-shadow: none;
184+
}}
185+
186+
table {{
187+
page-break-inside: auto;
188+
}}
189+
190+
tr {{
191+
page-break-inside: avoid;
192+
page-break-after: auto;
193+
}}
194+
}}
195+
</style>
196+
</head>
197+
<body>
198+
<div class="container">
199+
{html_body}
200+
</div>
201+
</body>
202+
</html>"""
203+
204+
# Write HTML file
205+
with open(html_file, "w", encoding="utf-8") as f:
206+
f.write(html_template)
207+
208+
print(f"✓ Converted {md_file} to {html_file}")
209+
210+
211+
if __name__ == "__main__":
212+
script_dir = Path(__file__).parent
213+
md_file = script_dir / "pr_report.md"
214+
html_file = script_dir / "pr_report.html"
215+
216+
convert_md_to_html(md_file, html_file)

0 commit comments

Comments
 (0)