~boringcactus/gemifedi

35cfebd710ef9abc7e5b4724e722dff4de38f28c — Melody Horn 2 years ago b5f6c15
escape leading # etc in post text
3 files changed, 15 insertions(+), 1 deletions(-)

M Cargo.lock
M Cargo.toml
M src/html2gemtext.rs
M Cargo.lock => Cargo.lock +1 -1
@@ 883,7 883,7 @@ dependencies = [
[[package]]
name = "gemtext"
version = "0.1.0"
source = "git+https://tulpa.dev/boringcactus/maj.git?branch=preserve-client-certs#290c2626d1cadf66b9bb6ca2fa75dc00014dd5f1"
source = "git+https://tulpa.dev/boringcactus//maj?branch=preserve-texthood-of-text-nodes#3cd71ce30252053aa82c95dfe504c76389bc9a49"

[[package]]
name = "generic-array"

M Cargo.toml => Cargo.toml +3 -0
@@ 26,3 26,6 @@ tempfile = "3"
toml = "0.5.6"
url = "2.1.1"
webpki = "0.21.3"

[patch."https://tulpa.dev/boringcactus/maj.git"]
gemtext = { git = "https://tulpa.dev/boringcactus//maj", branch = "preserve-texthood-of-text-nodes" }

M src/html2gemtext.rs => src/html2gemtext.rs +11 -0
@@ 149,4 149,15 @@ mod test {
            .build();
        assert_eq!(expected, parse_html(broken_example));
    }

    #[test]
    fn test_thing_that_should_work() {
        let example = gemtext::Node::Text("#1 fav food: chocolate".to_string());
        let mut result = Vec::<u8>::new();
        gemtext::render(vec![example], &mut result).unwrap();
        let result = String::from_utf8(result).unwrap();
        let parsed = gemtext::parse(&result);
        let not_what_i_asked_for = gemtext::Node::Heading { level: 1, body: "1 fav food: chocolate".to_string() };
        assert_ne!(parsed[0], not_what_i_asked_for);
    }
}