import json # 1. Load the faithful JSON data with open("scratch/faithful_docs_data.json") as f: docs_data = json.load(f) # 2. Load the original FASTAPI_BACKEND_API_DOCS.html with open("/home/creserver/Desktop/Vaishno_workspace/docs/FASTAPI_BACKEND_API_DOCS.html") as f: orig_html = f.read() # Extract head from orig_html up to orig_head = orig_html.split('')[0] # Add our clean CSS additions that preserve 100% of the original CSS grid and variables clean_css_additions = """ /* ─── URL Bar & Endpoint Tabs (Clean integration) ─── */ .ep-full-url-bar { display: flex; align-items: center; gap: 12px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 16px 0; flex-wrap: wrap; } .ep-full-url-bar code { font-family: var(--mono); font-size: 13.5px; color: var(--acc); word-break: break-all; flex: 1; min-width: 0; } .ep-tabs-wrapper { margin: 16px 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); } .ep-tabs-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink3); margin-bottom: 8px; display: block; } .ep-tabs { display: flex; gap: 8px; flex-wrap: wrap; } .ep-tab { padding: 7px 12px; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); font-size: 13px; font-weight: 500; color: var(--ink2); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: all 0.15s; } .ep-tab:hover { border-color: var(--acc); color: var(--ink); } .ep-tab.active { background: var(--card); border-color: var(--acc); color: var(--acc); font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,0.06); } .ep-tab .m { padding: 3px 6px; font-size: 10.5px; margin: 0; } .chip.copied { background: var(--opbg) !important; color: var(--opfg) !important; border-color: var(--opbd) !important; } /* ─── Header Session Pill & Admin Button ─── */ .session-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); font-size: 13px; font-family: var(--mono); color: var(--ink2); font-weight: 500; } .session-pill.warning { background: var(--rqbg); color: var(--rqfg); border-color: var(--rqbd); } .btn-admin { display: inline-flex; align-items: center; gap: 6px; color: var(--acc); border-color: var(--acc); font-weight: 600; } .btn-admin:hover { background: var(--tint); } """ html_head = orig_head + clean_css_additions + "\n\n\n\n
\n" json_tag = f'\n' # Perfect script that preserves the original accordion and renders single endpoints identically to multi endpoints js_code = """ """ full_html = html_head + json_tag + js_code with open("web/docs/index.html", "w") as f: f.write(full_html) with open("web/docs/FASTAPI_BACKEND_API_DOCS.html", "w") as f: f.write(full_html) print("Generated clean, responsive index.html and FASTAPI_BACKEND_API_DOCS.html successfully!")