sdtk-spec-kit 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -36,6 +36,14 @@ MERMAID_VENDOR_PATH = Path(__file__).parent / "vendor" / "mermaid.min.js"
|
|
|
36
36
|
MERMAID_ASSET_NAME = "mermaid.min.js"
|
|
37
37
|
_VIEWER_TEMPLATE_PATH = Path(__file__).parent / "doc_atlas_viewer_template.html"
|
|
38
38
|
|
|
39
|
+
|
|
40
|
+
def _json_for_inline_script(value: Any) -> str:
|
|
41
|
+
return (
|
|
42
|
+
json.dumps(value, ensure_ascii=True, separators=(",", ":"))
|
|
43
|
+
.replace("</", "<\\/")
|
|
44
|
+
.replace("<!--", "<\\!--")
|
|
45
|
+
)
|
|
46
|
+
|
|
39
47
|
# ---------------------------------------------------------------------------
|
|
40
48
|
# Default consumer project exclude fragments
|
|
41
49
|
# ---------------------------------------------------------------------------
|
|
@@ -678,9 +686,9 @@ _FAMILY_COLORS = {
|
|
|
678
686
|
def build_viewer(index: dict, graph: dict, generated: str) -> str:
|
|
679
687
|
if not _VIEWER_TEMPLATE_PATH.exists():
|
|
680
688
|
raise FileNotFoundError(f"Viewer template not found: {_VIEWER_TEMPLATE_PATH}")
|
|
681
|
-
index_json =
|
|
682
|
-
graph_json =
|
|
683
|
-
family_colors_json =
|
|
689
|
+
index_json = _json_for_inline_script(index)
|
|
690
|
+
graph_json = _json_for_inline_script(graph)
|
|
691
|
+
family_colors_json = _json_for_inline_script(_FAMILY_COLORS)
|
|
684
692
|
template = _VIEWER_TEMPLATE_PATH.read_text(encoding="utf-8")
|
|
685
693
|
return (
|
|
686
694
|
template
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Atlas Dashboard</title>
|
|
7
|
+
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='16' fill='%235f89ff'/%3E%3Ctext x='32' y='42' text-anchor='middle' font-family='Segoe UI,Arial,sans-serif' font-size='28' font-weight='700' fill='white'%3EA%3C/text%3E%3C/svg%3E">
|
|
7
8
|
<style>
|
|
8
9
|
*{margin:0;padding:0;box-sizing:border-box}
|
|
9
10
|
:root{
|
|
@@ -1019,12 +1020,27 @@ function scheduleMermaidRender(root) {
|
|
|
1019
1020
|
renderMermaidDiagrams(root);
|
|
1020
1021
|
});
|
|
1021
1022
|
}
|
|
1022
|
-
function
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
}
|
|
1023
|
+
function normalizeEmbeddedAssetPath(rawPath) {
|
|
1024
|
+
let value = String(rawPath || '').trim();
|
|
1025
|
+
if (!value) return '';
|
|
1026
|
+
if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
|
|
1027
|
+
value = value.slice(1, -1).trim();
|
|
1028
|
+
}
|
|
1029
|
+
if (value.startsWith('<') && value.endsWith('>')) {
|
|
1030
|
+
value = value.slice(1, -1).trim();
|
|
1031
|
+
}
|
|
1032
|
+
const titleMatch = value.match(/^(\S+)\s+(?:"[^"]*"|'[^']*')$/);
|
|
1033
|
+
if (titleMatch) {
|
|
1034
|
+
value = titleMatch[1].trim();
|
|
1035
|
+
}
|
|
1036
|
+
return value;
|
|
1037
|
+
}
|
|
1038
|
+
function resolveEmbeddedAssetPath(rawPath) {
|
|
1039
|
+
const value = normalizeEmbeddedAssetPath(rawPath);
|
|
1040
|
+
if (!value) return '';
|
|
1041
|
+
if (/^(https?:|data:|file:|#)/i.test(value)) return value;
|
|
1042
|
+
return `../../../../${value.replace(/^\.\//, '').replace(/\\/g, '/')}`;
|
|
1043
|
+
}
|
|
1028
1044
|
function extractHtmlAttribute(rawHtml, name) {
|
|
1029
1045
|
const match = String(rawHtml || '').match(new RegExp(`${name}\s*=\s*["']([^"']+)["']`, 'i'));
|
|
1030
1046
|
return match ? match[1] : '';
|