mirror of
https://github.com/TxtDot/dalet-rs.git
synced 2024-11-24 09:36: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]]
|
[[package]]
|
||||||
name = "dalet"
|
name = "dalet"
|
||||||
version = "1.0.0-pre7"
|
version = "1.0.0-pre8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"clap",
|
"clap",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "dalet"
|
name = "dalet"
|
||||||
version = "1.0.0-pre7"
|
version = "1.0.0-pre8"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["artegoser"]
|
authors = ["artegoser"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::typed::{
|
use crate::typed::{
|
||||||
Body, Hl,
|
Body, Hl, TNArg,
|
||||||
Tag::{self, *},
|
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();
|
let url = body.next().ok_or(GemTextParseError::InvalidLink)?.trim();
|
||||||
|
|
||||||
match body.next() {
|
match body.next() {
|
||||||
Some(label) => {
|
Some(label) => page.push(P(
|
||||||
page.push(P(vec![Btn(label.trim().into(), url.into()).into()].into()))
|
vec![Navlink(label.trim().into(), url.into()).into()].into()
|
||||||
}
|
)),
|
||||||
None => page.push(P(vec![Btn(Body::Null, url.into())].into())),
|
None => page.push(P(vec![Navlink(Body::Null, url.into())].into())),
|
||||||
};
|
};
|
||||||
} else if line.starts_with("# ") {
|
} else if line.starts_with("# ") {
|
||||||
let body = line.split_off(2);
|
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);
|
let body = line.split_off(4);
|
||||||
page.push(H(body.trim().into(), Hl::Three));
|
page.push(H(body.trim().into(), Hl::Three));
|
||||||
} else if line.starts_with("* ") {
|
} else if line.starts_with("* ") {
|
||||||
list_before = true;
|
|
||||||
let body = line.split_off(2);
|
let body = line.split_off(2);
|
||||||
list.push(El(body.into()));
|
list.push(El(body.into()));
|
||||||
|
list_before = true;
|
||||||
} else if line.starts_with("> ") {
|
} else if line.starts_with("> ") {
|
||||||
let body = line.split_off(2);
|
let body = line.split_off(2);
|
||||||
page.push(Bq(body.into()));
|
page.push(Bq(body.into()));
|
||||||
} else if line.starts_with("```") {
|
} else if line.starts_with("```") {
|
||||||
if preformatted {
|
if preformatted {
|
||||||
page.push(Pre(preformatted_text.join("\n")));
|
page.push(Code(preformatted_text.join("\n"), TNArg::Null));
|
||||||
preformatted_text.clear();
|
preformatted_text.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue