forked from k8tre/k8tre
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
37 lines (29 loc) · 1020 Bytes
/
Copy pathmain.py
File metadata and controls
37 lines (29 loc) · 1020 Bytes
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
def define_env(env):
@env.macro
def spec_content(meta):
topic = meta.get("topic", "No Topic")
statement = meta.get("k8tre_statements", {}).get("spec", "No statement provided.")
updated = meta.get("last_updated", "Unknown")
source = meta.get("discussion") or "N/A"
return f"""
# {topic}
!!! abstract "Specification"
{statement}
Last updated: {updated}
Source: {source}
"""
@env.macro
def satre_link(meta):
satre_items = meta.get("k8tre_statements", {}).get("satre", [])
# Build SATRE section only if items exist
satre_md = ""
if isinstance(satre_items, list) and satre_items:
satre_md = "## SATRE components realised by this statement"
for item in satre_items:
ref = item.get("ref", "No ref")
rationale = item.get("rationale", "No rationale provided.")
satre_md += f"""
**Component {ref}**
{rationale}
"""
return satre_md