commit 330d4ef855d24d3ad5c9226f70175058076e888c
parent dd2eb3af036149db3350aa56e3642fbcbc51cdb7
Author: Joris Hartog <jorishartog@hotmail.com>
Date: Thu, 13 Aug 2026 09:12:57 +0200
Polish static source browser
Diffstat:
5 files changed, 127 insertions(+), 10 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -5,3 +5,5 @@
/src-tauri/binaries/iuna-sidecar-*
/downloads/*
!/downloads/.gitkeep
+__pycache__/
+*.py[cod]
diff --git a/Dockerfile b/Dockerfile
@@ -12,6 +12,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config \
libgit2-dev \
git \
+ python3 \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
@@ -55,7 +56,8 @@ RUN set -eux; \
cp /src/iuna-work/src-tauri/icons/32x32.png /site/git/logo.png; \
cp /src/iuna-work/src-tauri/icons/32x32.png /site/git/iuna/logo.png; \
cp -a /src/iuna.git /site/git/iuna.git; \
- find /site/git -type f -name '*.html' -exec sed -i -E 's|<a href="(\.\./)+"><img |<a href="/"><img |g' {} +
+ find /site/git -type f -name '*.html' -exec sed -i -E 's|<a href="(\.\./)+"><img |<a href="/"><img |g' {} +; \
+ python3 /src/iuna-work/scripts/postprocess_stagit_site.py /site/git
COPY www /site
COPY downloads /site/downloads
diff --git a/scripts/postprocess_stagit_site.py b/scripts/postprocess_stagit_site.py
@@ -0,0 +1,61 @@
+#!/usr/bin/env python3
+import re
+import sys
+from pathlib import Path
+
+
+TOPBAR = """
+<div class="topbar">
+ <div class="wrap">
+ <a class="brand repo-link" href="/"><span class="mark" aria-label="iuna"><svg viewBox="0 0 32 32" aria-hidden="true" focusable="false"><circle class="mark-dot" cx="9.4" cy="7.6" r="2.8"></circle><path class="mark-loop" d="M9.4 13v7.1c0 3.7 2.9 6.4 6.6 6.4s6.6-2.7 6.6-6.4V13"></path></svg></span><span>iuna</span></a>
+ <nav aria-label="Page sections">
+ <a href="/#whatisiuna">What is iuna</a>
+ <a href="/#howtojoin">Join</a>
+ <a href="/git/iuna/file/docs/protocol.md.html">Protocol</a>
+ <a href="/git/iuna/file/README.md.html">Source</a>
+ <a href="/downloads/">Downloads</a>
+ </nav>
+ </div>
+</div>"""
+
+
+def postprocess_html(html: str) -> str:
+ if '<div class="topbar">' not in html:
+ html = re.sub(r"<body([^>]*)>", r"<body\1>\n" + TOPBAR, html, count=1)
+
+ html = re.sub(
+ r"<td id=\"logo\"[^>]*>.*?</td>",
+ "",
+ html,
+ count=1,
+ flags=re.S,
+ )
+ html = re.sub(
+ r"<td><a href=\"[^\"]*\"><img src=\"[^\"]*logo\.png\"[^>]*></a></td>",
+ "",
+ html,
+ count=1,
+ flags=re.S,
+ )
+ return re.sub(r"<tr([^>]*)><td></td><td>", r"<tr\1><td>", html)
+
+
+def main() -> int:
+ if len(sys.argv) != 2:
+ print(f"Usage: {sys.argv[0]} <generated-git-root>", file=sys.stderr)
+ return 2
+
+ git_root = Path(sys.argv[1])
+ if not git_root.is_dir():
+ print(f"error: generated git root does not exist: {git_root}", file=sys.stderr)
+ return 1
+
+ for path in git_root.rglob("*.html"):
+ html = path.read_text(encoding="utf-8")
+ path.write_text(postprocess_html(html), encoding="utf-8")
+
+ return 0
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/www/assets/static-listing.css b/www/assets/static-listing.css
@@ -39,12 +39,8 @@ a.line:target {
background: rgba(255, 255, 255, .04);
}
-img.logo, #logo img {
- width: 32px;
- height: 32px;
- border-radius: 8px;
- vertical-align: middle;
- margin-right: 10px;
+img.logo, #logo {
+ display: none;
}
h1, h2, h3 { letter-spacing: 0; }
@@ -143,13 +139,46 @@ pre, code {
}
pre {
- overflow-x: auto;
+ white-space: pre-wrap;
+ overflow-x: visible;
+ overflow-wrap: anywhere;
border: 1px solid var(--line);
border-radius: 8px;
padding: 14px;
background: #0b0d0e;
}
+pre#blob,
+#blob {
+ overflow-x: visible;
+ table-layout: fixed;
+}
+
+#blob td:first-child {
+ width: 1%;
+ white-space: nowrap;
+}
+
+#blob td:last-child {
+ width: 99%;
+ min-width: 0;
+}
+
+#blob pre,
+#blob code {
+ white-space: pre-wrap;
+ overflow-wrap: anywhere;
+ word-break: break-word;
+}
+
+#blob pre {
+ margin: 0;
+ border: 0;
+ border-radius: 0;
+ padding: 0;
+ background: transparent;
+}
+
table {
width: 100%;
border-collapse: collapse;
@@ -199,6 +228,29 @@ tr:last-child td { border-bottom: 0; }
font-size: 15px;
}
+#content > p:first-child {
+ margin: 18px 0;
+ padding: 10px 14px;
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ background: var(--panel-2);
+ color: var(--text);
+ font-weight: 850;
+}
+
+#content > h1,
+#content > h2,
+#content > h3,
+body > h1,
+body > h2,
+body > h3 {
+ margin: 18px auto;
+ padding: 10px 14px;
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ background: var(--panel-2);
+}
+
#navbar a {
font-weight: 800;
}
diff --git a/www/index.html b/www/index.html
@@ -333,7 +333,7 @@
<a href="#whatisiuna">What is iuna</a>
<a href="#howtojoin">Join</a>
<a href="/git/iuna/file/docs/protocol.md.html">Protocol</a>
- <a href="/git/iuna/">Source</a>
+ <a href="/git/iuna/file/README.md.html">Source</a>
<a href="/downloads/">Downloads</a>
</nav>
</div>
@@ -447,7 +447,7 @@
<section class="footer">
<div class="wrap">
<span>iuna devnet prototype.</span>
- <a href="/git/iuna/">Source</a>
+ <a href="/git/iuna/file/README.md.html">Source</a>
</div>
</section>
</body>