From 2fd17796c00c66784c7518c3d150a32103f7d326 Mon Sep 17 00:00:00 2001 From: Artemy Egorov Date: Sun, 4 Aug 2024 15:58:46 +0300 Subject: [PATCH] fix: gemtext list parsing --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/parsers/gemtext.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 005c5d0..68cf7b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -151,7 +151,7 @@ dependencies = [ [[package]] name = "dalet" -version = "1.0.0-pre8" +version = "1.0.0-pre9" dependencies = [ "bincode", "clap", diff --git a/Cargo.toml b/Cargo.toml index e1c538e..39e232b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dalet" -version = "1.0.0-pre8" +version = "1.0.0-pre9" edition = "2021" authors = ["artegoser"] license = "MIT" diff --git a/src/parsers/gemtext.rs b/src/parsers/gemtext.rs index e69fd97..811d63d 100644 --- a/src/parsers/gemtext.rs +++ b/src/parsers/gemtext.rs @@ -19,12 +19,12 @@ pub fn parse_gemtext(s: &str) -> Result, GemTextParseError> { for line in s.lines() { let mut line = line.trim().to_owned(); - if list_before && !line.starts_with("* ") { + if preformatted && !line.starts_with("```") { + preformatted_text.push(line); + } else if list_before && !line.starts_with("* ") { page.push(Tag::Ul(list.clone())); list_before = false; list.clear(); - } else if preformatted && !line.starts_with("```") { - preformatted_text.push(line); } else if line.starts_with("=>") { let body = line.split_off(2); let mut body = body.trim().splitn(2, " ");