Bubble [main]

Adjusted link styling; prefix link labels inside comments

=> 16a0bd6505f53e882812ac0fbc9920380977c8e2

diff --git a/50_bubble.py b/50_bubble.py
index aaf8091..e1d7aa8 100644
--- a/50_bubble.py
+++ b/50_bubble.py
@@ -247,6 +247,9 @@ Bubble is open source:
                 title_prefix = f'[#{post.issueid}] ' if post.issueid else ''
                 src += f'# {title_prefix}{post.title}\n\n'
 
+            # In comments, differentiate between content links and UI links for clarity.
+            link_prefix = '— ' if post.parent else ''
+
             last_type = None
             for segment in self.db.get_segments(post, poll=False):
                 # Optionally, separate by newline.
@@ -256,11 +259,17 @@ Bubble is open source:
                         src += '\n'
 
                 if segment.type == Segment.TEXT:
-                    src += segment.content + '\n'
+                    src += prefix_links(segment.content, link_prefix) + '\n'
                     last_type = segment.type
 
                 elif segment.type in [Segment.LINK, Segment.IMAGE, Segment.ATTACHMENT]:
-                    src += f'=> {segment.url} {segment.content}\n'
+                    label = segment.content
+                    if len(label) == 0:
+                        # No label; show the URL sans `gemini`` scheme.
+                        label = segment.url
+                        if label.startswith('gemini://'):
+                            label = label[9:]
+                    src += f'=> {segment.url} {link_prefix}{label}\n'
                     last_type = segment.type
 
             return src
diff --git a/feeds.py b/feeds.py
index f82f9d0..0e164b9 100644
--- a/feeds.py
+++ b/feeds.py
@@ -280,7 +280,7 @@ def make_post_page(session, post):
             # Commits are shown as links to the Git viewer.
             if isinstance(cmt, Commit):
                 rendered_comments.append(
-                    f'=> {repo.view_url}/{cmt.hash} 🛢️ {cmt.hash[:8]} · {clean_title(cmt.msg)}\n' +
+                    f'=> {repo.view_url}/{cmt.hash} Commit {cmt.hash[:8]} · {clean_title(cmt.msg)}\n' +
                     ago_text(cmt.ts) + '\n'
                 )
                 continue
diff --git a/model.py b/model.py
index 8f2ece0..022eb29 100644
--- a/model.py
+++ b/model.py
@@ -987,6 +987,8 @@ class Database:
             seg_content = seg.content.strip()
             if len(seg_content) == 0:
                 seg_content = seg.url
+                if seg_content.startswith('gemini://'):
+                    seg_content = seg_content[9:] # Omit default scheme.
             render += f'=> {seg.url} — {seg_content}\n'
             break
 
diff --git a/utils.py b/utils.py
index 287b132..62f1770 100644
--- a/utils.py
+++ b/utils.py
@@ -97,6 +97,26 @@ def clean_tinylog(text):
     return '\n'.join(clean)
 
 
+def prefix_links(src, prefix):
+    """Add a prefix to link labels."""
+    if not prefix:
+        return src
+    lines = []
+    pattern = re.compile(r'^\s*=>\s*([^ ]+)(\s+(.*))?$')
+    for line in src.split('\n'):
+        m = pattern.match(line)
+        if m:
+            label = m[3].strip() if m[3] and len(m[3]) else ''
+            if len(label) == 0:
+                label = m[1]
+                # Omit gemini scheme.
+                if label.startswith('gemini://'):
+                    label = label[9:]
+            line = f'=> {m[1]} {prefix}{label}'
+        lines.append(line)
+    return '\n'.join(lines)
+
+
 def shorten_text(text, n):
     """Truncate and cut at white or word boundary."""
     text = text[:n]
Proxy Information
Original URL
gemini://git.skyjake.fi/bubble/main/cdiff/16a0bd6505f53e882812ac0fbc9920380977c8e2
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
348.106454 milliseconds
Gemini-to-HTML Time
0.185764 milliseconds

This content has been proxied by September (ba2dc).