commit ed1be64e245bb47813e7a74e6cab6fc029f77010
parent 64402afc38277d0dd09212c75fcc0f21ca559fb9
Author: Joris Hartog <jorishartog@hotmail.com>
Date: Tue, 15 Sep 2026 13:07:44 +0200
fix(web): render clone command as code
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/scripts/postprocess_stagit_site.py b/scripts/postprocess_stagit_site.py
@@ -42,12 +42,22 @@ def postprocess_html(html: str, path: Path | None = None) -> str:
flags=re.S,
)
html = re.sub(r"<tr([^>]*)><td></td><td>", r"<tr\1><td>", html)
+ html = style_clone_command(html)
if path is not None and is_markdown_file_page(path):
html = style_markdown_blob(html)
return html
+def style_clone_command(html: str) -> str:
+ return re.sub(
+ r'git clone\s+<a\s+href="[^"]+"[^>]*>(.*?)</a>',
+ r'<code class="clone-command">git clone \1</code>',
+ html,
+ flags=re.S,
+ )
+
+
def is_markdown_file_page(path: Path) -> bool:
return path.name.endswith(".md.html") or path.name.endswith(".markdown.html")