mirror of
https://github.com/TxtDot/dalet-rs.git
synced 2024-11-21 16:26:21 +03:00
fix: gemtext tags
This commit is contained in:
parent
104968f95e
commit
8fb4f31ece
3 changed files with 9 additions and 9 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -151,7 +151,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dalet"
|
||||
version = "1.0.0-pre7"
|
||||
version = "1.0.0-pre8"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"clap",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "dalet"
|
||||
version = "1.0.0-pre7"
|
||||
version = "1.0.0-pre8"
|
||||
edition = "2021"
|
||||
authors = ["artegoser"]
|
||||
license = "MIT"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::typed::{
|
||||
Body, Hl,
|
||||
Body, Hl, TNArg,
|
||||
Tag::{self, *},
|
||||
};
|
||||
|
||||
|
@ -32,10 +32,10 @@ pub fn parse_gemtext(s: &str) -> Result<Vec<Tag>, GemTextParseError> {
|
|||
let url = body.next().ok_or(GemTextParseError::InvalidLink)?.trim();
|
||||
|
||||
match body.next() {
|
||||
Some(label) => {
|
||||
page.push(P(vec![Btn(label.trim().into(), url.into()).into()].into()))
|
||||
}
|
||||
None => page.push(P(vec![Btn(Body::Null, url.into())].into())),
|
||||
Some(label) => page.push(P(
|
||||
vec![Navlink(label.trim().into(), url.into()).into()].into()
|
||||
)),
|
||||
None => page.push(P(vec![Navlink(Body::Null, url.into())].into())),
|
||||
};
|
||||
} else if line.starts_with("# ") {
|
||||
let body = line.split_off(2);
|
||||
|
@ -47,15 +47,15 @@ pub fn parse_gemtext(s: &str) -> Result<Vec<Tag>, GemTextParseError> {
|
|||
let body = line.split_off(4);
|
||||
page.push(H(body.trim().into(), Hl::Three));
|
||||
} else if line.starts_with("* ") {
|
||||
list_before = true;
|
||||
let body = line.split_off(2);
|
||||
list.push(El(body.into()));
|
||||
list_before = true;
|
||||
} else if line.starts_with("> ") {
|
||||
let body = line.split_off(2);
|
||||
page.push(Bq(body.into()));
|
||||
} else if line.starts_with("```") {
|
||||
if preformatted {
|
||||
page.push(Pre(preformatted_text.join("\n")));
|
||||
page.push(Code(preformatted_text.join("\n"), TNArg::Null));
|
||||
preformatted_text.clear();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue