♻️ Simple & Efficient Gemini-to-HTTP Proxy fuwn.net
proxy gemini-protocol protocol gemini http rust
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(html): clear adjacent link indicators

Fuwn 48c9004e cf0a07b5

+55 -2
+10
default.css
··· 269 269 } 270 270 } 271 271 272 + .gemini-fragment { 273 + -webkit-touch-callout: none; 274 + -webkit-user-select: none; 275 + -khtml-user-select: none; 276 + -moz-user-select: none; 277 + -ms-user-select: none; 278 + user-select: none; 279 + color: var(--muted); 280 + } 281 + 272 282 /* * { 273 283 transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, 274 284 border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
+45 -2
src/html.rs
··· 28 28 let mut html = String::new(); 29 29 let mut title = String::new(); 30 30 let mut previous_link = false; 31 + let mut previous_link_count = 0; 31 32 let condense_links = { 32 33 let links = var("CONDENSE_LINKS").map_or_else( 33 34 |_| vec![], ··· 52 53 in_condense_links_flag_trap = true; 53 54 } 54 55 56 + let align_adjacent_links = |html: &str| { 57 + if previous_link_count > 0 { 58 + html 59 + .chars() 60 + .rev() 61 + .collect::<String>() 62 + .replacen( 63 + &r#"<span class="gemini-fragment">=&#62;</span> "# 64 + .chars() 65 + .rev() 66 + .collect::<String>(), 67 + "", 68 + 1, 69 + ) 70 + .chars() 71 + .rev() 72 + .collect::<String>() 73 + } else { 74 + html.to_string() 75 + } 76 + }; 77 + 55 78 if previous_link 56 79 && (!matches!(node, Node::Link { .. }) 57 80 || (!condense_links && !in_condense_links_flag_trap)) 58 81 { 59 - html.push_str("\n</p>"); 82 + if let Some(next) = ast.iter().skip_while(|n| n != &node).nth(1) { 83 + if matches!(next, Node::Link { .. }) || previous_link { 84 + html.push_str("<br />"); 85 + } else { 86 + html.push_str("</p>"); 87 + } 88 + } else { 89 + html.push_str("</p>"); 90 + } 91 + 60 92 previous_link = false; 93 + html = align_adjacent_links(&html); 94 + previous_link_count = 0; 61 95 } else if previous_link { 96 + html = align_adjacent_links(&html); 97 + 62 98 html.push_str(" <span style=\"opacity: 50%;\">|</span> "); 99 + 100 + previous_link_count += 1; 63 101 } else if !previous_link && matches!(node, Node::Link { .. }) { 64 102 html.push_str("<p>"); 65 103 } ··· 184 222 previous_link = true; 185 223 186 224 html.push_str(&format!( 187 - "<a href=\"{}\">{}</a>", 225 + r#"{}<a href="{}">{}</a>"#, 226 + if condense_links { 227 + "" 228 + } else { 229 + r#"<span class="gemini-fragment">=&#62;</span> "# 230 + }, 188 231 href, 189 232 safe(text.as_ref().unwrap_or(to)), 190 233 ));