diff options
| -rw-r--r-- | Cargo.lock | 2 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | src/html.rs | 21 |
3 files changed, 8 insertions, 17 deletions
@@ -2143,7 +2143,7 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" [[package]] name = "september" -version = "0.2.29" +version = "0.2.30" dependencies = [ "actix-web", "anyhow", @@ -2,7 +2,7 @@ [package] name = "september" -version = "0.2.29" +version = "0.2.30" authors = ["Fuwn <[email protected]>"] edition = "2021" description = "A simple and efficient Gemini-to-HTTP proxy." diff --git a/src/html.rs b/src/html.rs index 8efd7d9..299242c 100644 --- a/src/html.rs +++ b/src/html.rs @@ -21,6 +21,8 @@ pub fn from_gemini( url: &Url, configuration: &crate::response::configuration::Configuration, ) -> Option<(String, String)> { + const GEMINI_FRAGMENT: &str = + r#"<span class="gemini-fragment">=> </span>"#; let ast_tree = germ::ast::Ast::from_string( response.content().as_ref().map_or_else(String::default, String::clone), ); @@ -59,14 +61,7 @@ pub fn from_gemini( .chars() .rev() .collect::<String>() - .replacen( - &r#"<span class="gemini-fragment">=></span> "# - .chars() - .rev() - .collect::<String>(), - "", - 1, - ) + .replacen(&GEMINI_FRAGMENT.chars().rev().collect::<String>(), "", 1) .chars() .rev() .collect::<String>() @@ -95,7 +90,7 @@ pub fn from_gemini( } else if previous_link { html = align_adjacent_links(&html); - html.push_str(" <span style=\"opacity: 50%;\">|</span> "); + html.push_str(r#" <span class="gemini-fragment">|</span> "#); previous_link_count += 1; } else if !previous_link && matches!(node, Node::Link { .. }) { @@ -223,13 +218,9 @@ pub fn from_gemini( html.push_str(&format!( r#"{}<a href="{}">{}</a>"#, - if condense_links { - "" - } else { - r#"<span class="gemini-fragment">=></span> "# - }, + if condense_links { "" } else { GEMINI_FRAGMENT }, href, - safe(text.as_ref().unwrap_or(to)), + safe(text.as_ref().unwrap_or(to)).trim(), )); } Node::Heading { level, text } => { |