aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-06-02 04:13:59 +0000
committerFuwn <[email protected]>2022-06-02 04:13:59 +0000
commita922c4361093092caf07b646466902cd66f12179 (patch)
treea2ddea5b8d7983b8ede60b07640dddd89631d0c7 /src
parentfeat(response): show meta when non-success response (diff)
downloadseptember-a922c4361093092caf07b646466902cd66f12179.tar.xz
september-a922c4361093092caf07b646466902cd66f12179.zip
deps(germ): bump and use new-style ast
Diffstat (limited to 'src')
-rw-r--r--src/gemini_to_html.rs10
1 files changed, 6 insertions, 4 deletions
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!(
"<p><a href=\"{}\">{}</a></p>\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!(
"<ul>{}</ul>",
items
- .into_iter()
+ .iter()
.map(|i| format!("<li>{}</li>", i))
.collect::<Vec<String>>()
.join("\n")