🦠 The Definitive Gemini Protocol Toolkit
gemini gemini-protocol gemtext parser zero-dependency toolkit ast converter html markdown cli networking
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(container.rs): preformatted block escaping newline

Fuwn 07e81006 5d892d27

+36 -1
+31
crates/germ/examples/request_to_gemtext_from_ast.rs
··· 1 + // This file is part of Germ <https://github.com/gemrest/germ>. 2 + // Copyright (C) 2022-2022 Fuwn <contact@fuwn.me> 3 + // 4 + // This program is free software: you can redistribute it and/or modify 5 + // it under the terms of the GNU General Public License as published by 6 + // the Free Software Foundation, version 3. 7 + // 8 + // This program is distributed in the hope that it will be useful, but 9 + // WITHOUT ANY WARRANTY; without even the implied warranty of 10 + // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 + // General Public License for more details. 12 + // 13 + // You should have received a copy of the GNU General Public License 14 + // along with this program. If not, see <http://www.gnu.org/licenses/>. 15 + // 16 + // Copyright (C) 2022-2022 Fuwn <contact@fuwn.me> 17 + // SPDX-License-Identifier: GPL-3.0-only 18 + 19 + fn main() { 20 + match germ::request::request(&url::Url::parse("gemini://fuwn.me/").unwrap()) { 21 + Ok(response) => 22 + println!( 23 + "{}", 24 + germ::ast::Ast::from_string( 25 + &*response.content().clone().unwrap_or_else(|| "".to_string()) 26 + ) 27 + .to_gemtext() 28 + ), 29 + Err(_) => {} 30 + } 31 + }
+5 -1
crates/germ/src/ast/container.rs
··· 258 258 // preformatted blocks content and increment the line. 259 259 preformatted.push_str(&format!("{}\n", line)); 260 260 261 - line = lines.next().unwrap(); 261 + if let Some(next_line) = lines.next() { 262 + line = next_line; 263 + } else { 264 + break; 265 + } 262 266 } else { 263 267 // If we are in a list item and hit a catchall, that must mean that 264 268 // we encountered a line which is not a list line, so