From a922c4361093092caf07b646466902cd66f12179 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 2 Jun 2022 04:13:59 +0000 Subject: deps(germ): bump and use new-style ast --- src/gemini_to_html.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gemini_to_html.rs b/src/gemini_to_html.rs index 8adfd52..7e0d6e2 100644 --- a/src/gemini_to_html.rs +++ b/src/gemini_to_html.rs @@ -41,7 +41,9 @@ pub fn gemini_to_html( url: &Url, is_proxy: bool, ) -> (String, String) { - let ast = germ::ast::build(&String::from_utf8_lossy(&response.data)); + let ast_tree = + germ::ast::Ast::from_string(&String::from_utf8_lossy(&response.data)); + let ast = ast_tree.inner(); let mut html = String::new(); let mut title = "".to_string(); @@ -104,14 +106,14 @@ pub fn gemini_to_html( html.push_str(&format!( "

{}

\n", href, - text.unwrap_or_else(|| "".to_string()) + text.clone().unwrap_or_else(|| "".to_string()) )); } Node::Heading { level, text, } => { - if title.is_empty() && level == 1 { + if title.is_empty() && *level == 1 { title = text.clone(); } @@ -130,7 +132,7 @@ pub fn gemini_to_html( html.push_str(&format!( "", items - .into_iter() + .iter() .map(|i| format!("
  • {}
  • ", i)) .collect::>() .join("\n") -- cgit v1.2.3