mirror of
https://github.com/TxtDot/dalet-rs.git
synced 2024-11-21 16:26:21 +03:00
fix: pass &str instead of String in parse_gemtext
This commit is contained in:
parent
f45808fc40
commit
104968f95e
5 changed files with 6 additions and 9 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -151,7 +151,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dalet"
|
name = "dalet"
|
||||||
version = "1.0.0-pre6"
|
version = "1.0.0-pre7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"clap",
|
"clap",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "dalet"
|
name = "dalet"
|
||||||
version = "1.0.0-pre6"
|
version = "1.0.0-pre7"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["artegoser"]
|
authors = ["artegoser"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::typed::{
|
use crate::typed::{
|
||||||
Body, Hl, NNBody,
|
Body, Hl,
|
||||||
Tag::{self, *},
|
Tag::{self, *},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ pub enum GemTextParseError {
|
||||||
InvalidLink,
|
InvalidLink,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_gemtext(s: String) -> Result<Vec<Tag>, GemTextParseError> {
|
pub fn parse_gemtext(s: &str) -> Result<Vec<Tag>, GemTextParseError> {
|
||||||
let mut page: Vec<Tag> = Vec::new();
|
let mut page: Vec<Tag> = Vec::new();
|
||||||
let mut preformatted = false;
|
let mut preformatted = false;
|
||||||
let mut preformatted_text: Vec<String> = Vec::new();
|
let mut preformatted_text: Vec<String> = Vec::new();
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
use dalet::{
|
use dalet::{
|
||||||
daletl::ToDaletlPage,
|
daletl::ToDaletlPage,
|
||||||
daletpack::*,
|
daletpack::*,
|
||||||
typed::{
|
typed::{Hl, Page, TNArg, Tag::*},
|
||||||
Body, Hl, NNBody, Page, TNArg,
|
|
||||||
Tag::{self, *},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
use flate2::Compression;
|
use flate2::Compression;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
|
|
@ -4,7 +4,7 @@ use dalet::parsers::gemtext::parse_gemtext;
|
||||||
fn gem_text() {
|
fn gem_text() {
|
||||||
let text = include_str!("./gemtext.gmi");
|
let text = include_str!("./gemtext.gmi");
|
||||||
|
|
||||||
let parsed = parse_gemtext(text.to_owned()).unwrap();
|
let parsed = parse_gemtext(&text).unwrap();
|
||||||
|
|
||||||
println!("{:#?}", parsed);
|
println!("{:#?}", parsed);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue