From 8fb4f31ecee2aefd6a5121a00b4c787b0a7d2332 Mon Sep 17 00:00:00 2001 From: Artemy Egorov Date: Sun, 4 Aug 2024 15:42:45 +0300 Subject: [PATCH] fix: gemtext tags --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/parsers/gemtext.rs | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 91bf87a..005c5d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -151,7 +151,7 @@ dependencies = [ [[package]] name = "dalet" -version = "1.0.0-pre7" +version = "1.0.0-pre8" dependencies = [ "bincode", "clap", diff --git a/Cargo.toml b/Cargo.toml index 23ab30f..e1c538e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dalet" -version = "1.0.0-pre7" +version = "1.0.0-pre8" edition = "2021" authors = ["artegoser"] license = "MIT" diff --git a/src/parsers/gemtext.rs b/src/parsers/gemtext.rs index 7829bbe..e69fd97 100644 --- a/src/parsers/gemtext.rs +++ b/src/parsers/gemtext.rs @@ -1,5 +1,5 @@ use crate::typed::{ - Body, Hl, + Body, Hl, TNArg, Tag::{self, *}, }; @@ -32,10 +32,10 @@ pub fn parse_gemtext(s: &str) -> Result, GemTextParseError> { let url = body.next().ok_or(GemTextParseError::InvalidLink)?.trim(); match body.next() { - Some(label) => { - page.push(P(vec![Btn(label.trim().into(), url.into()).into()].into())) - } - None => page.push(P(vec![Btn(Body::Null, url.into())].into())), + Some(label) => page.push(P( + vec![Navlink(label.trim().into(), url.into()).into()].into() + )), + None => page.push(P(vec![Navlink(Body::Null, url.into())].into())), }; } else if line.starts_with("# ") { let body = line.split_off(2); @@ -47,15 +47,15 @@ pub fn parse_gemtext(s: &str) -> Result, GemTextParseError> { let body = line.split_off(4); page.push(H(body.trim().into(), Hl::Three)); } else if line.starts_with("* ") { - list_before = true; let body = line.split_off(2); list.push(El(body.into())); + list_before = true; } else if line.starts_with("> ") { let body = line.split_off(2); page.push(Bq(body.into())); } else if line.starts_with("```") { if preformatted { - page.push(Pre(preformatted_text.join("\n"))); + page.push(Code(preformatted_text.join("\n"), TNArg::Null)); preformatted_text.clear(); }