Fix finding-detail badge regex broken by the toc extension
badge_findings_table matched literal <h4> with no attributes; once the toc extension started stamping id="..." on every heading (needed for the sidebar nav), the h4 severity badges silently stopped rendering. Match <h4[^>]*> instead.
This commit is contained in:
+2
-2
@@ -347,14 +347,14 @@ def badge_findings_table(html_text):
|
|||||||
cell_html,
|
cell_html,
|
||||||
)
|
)
|
||||||
cell_html = re.sub(
|
cell_html = re.sub(
|
||||||
rf"(<h4>)\[{severity}\]",
|
rf"(<h4[^>]*>)\[{severity}\]",
|
||||||
rf'\1<span class="badge {css_class}">{severity}</span> ',
|
rf'\1<span class="badge {css_class}">{severity}</span> ',
|
||||||
cell_html,
|
cell_html,
|
||||||
)
|
)
|
||||||
return cell_html
|
return cell_html
|
||||||
|
|
||||||
html_text = re.sub(r"<td>\w+</td>", replace_cell, html_text)
|
html_text = re.sub(r"<td>\w+</td>", replace_cell, html_text)
|
||||||
html_text = re.sub(r"<h4>\[\w+\][^<]*", replace_cell, html_text)
|
html_text = re.sub(r"<h4[^>]*>\[\w+\][^<]*", replace_cell, html_text)
|
||||||
return html_text
|
return html_text
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user