mirror of
https://github.com/TxtDot/dalet-rs.git
synced 2024-11-24 01:26:22 +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]]
|
||||
name = "dalet"
|
||||
version = "1.0.0-pre6"
|
||||
version = "1.0.0-pre7"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"clap",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "dalet"
|
||||
version = "1.0.0-pre6"
|
||||
version = "1.0.0-pre7"
|
||||
edition = "2021"
|
||||
authors = ["artegoser"]
|
||||
license = "MIT"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::typed::{
|
||||
Body, Hl, NNBody,
|
||||
Body, Hl,
|
||||
Tag::{self, *},
|
||||
};
|
||||
|
||||
|
@ -8,7 +8,7 @@ pub enum GemTextParseError {
|
|||
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 preformatted = false;
|
||||
let mut preformatted_text: Vec<String> = Vec::new();
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
use dalet::{
|
||||
daletl::ToDaletlPage,
|
||||
daletpack::*,
|
||||
typed::{
|
||||
Body, Hl, NNBody, Page, TNArg,
|
||||
Tag::{self, *},
|
||||
},
|
||||
typed::{Hl, Page, TNArg, Tag::*},
|
||||
};
|
||||
use flate2::Compression;
|
||||
use std::io::Write;
|
||||
|
|
|
@ -4,7 +4,7 @@ use dalet::parsers::gemtext::parse_gemtext;
|
|||
fn gem_text() {
|
||||
let text = include_str!("./gemtext.gmi");
|
||||
|
||||
let parsed = parse_gemtext(text.to_owned()).unwrap();
|
||||
let parsed = parse_gemtext(&text).unwrap();
|
||||
|
||||
println!("{:#?}", parsed);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue