INNER CODE UNIT · Python
replace_id_table
OWASP/wstg · .github/ebooks/fix-typst-body.py:43
def replace_id_table(m: re.Match[str]) -> str:
id_val = m.group(1)
return f'''#block(
fill: rgb("#0080BD"),
stroke: none,
radius: 4pt,
inset: (x: 12pt, y: 8pt),
width: auto,
)[
#set text(fill: white, weight: "medium")
ID #h(1.5em) {id_val}
]'''
text = re.sub(
r'#align\(center\)\[#table\([^[]*\[ID\][^[]*\[(WSTG-[^\]]+)\][^]]*\)\s*\]',
replace_id_table,
text,
flags=re.DOTALL,