Spaces:
Sleeping
Sleeping
SVG: standalone download (XML prolog, white bg, fixed dims) + Plotly first
Browse files
app.py
CHANGED
|
@@ -581,9 +581,11 @@ def _download_links_html(sql: str, results: list[dict], svg: str) -> str:
|
|
| 581 |
f'<span class="icon">↓</span> CSV ({len(results):,} rows)</a>'
|
| 582 |
)
|
| 583 |
|
| 584 |
-
# SVG download
|
| 585 |
if svg and "<svg" in svg.lower():
|
| 586 |
-
|
|
|
|
|
|
|
| 587 |
parts.append(
|
| 588 |
f'<a class="download-link" '
|
| 589 |
f'href="data:image/svg+xml;base64,{svg_b64}" '
|
|
|
|
| 581 |
f'<span class="icon">↓</span> CSV ({len(results):,} rows)</a>'
|
| 582 |
)
|
| 583 |
|
| 584 |
+
# SVG download (standalone version: explicit dims, white bg, XML prolog)
|
| 585 |
if svg and "<svg" in svg.lower():
|
| 586 |
+
from src.visualization.svg_theme import to_standalone_svg
|
| 587 |
+
standalone = to_standalone_svg(svg)
|
| 588 |
+
svg_b64 = base64.b64encode(standalone.encode("utf-8")).decode("ascii")
|
| 589 |
parts.append(
|
| 590 |
f'<a class="download-link" '
|
| 591 |
f'href="data:image/svg+xml;base64,{svg_b64}" '
|