Skip to content

Commit

Permalink
make embed node better (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lurk authored Nov 22, 2023
1 parent 4269ebc commit 93b8ba8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yamd"
version = "0.11.0"
version = "0.11.1"
edition = "2021"
license = "MIT OR Apache-2.0"
description = "Yet Another Markdown Document (flavor)"
Expand Down
8 changes: 6 additions & 2 deletions src/nodes/embed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ impl Deserializer for Embed {
) -> Option<Self> {
let mut matcher = Matcher::new(input);
if let Some(embed) = matcher.get_match("{{", "}}", false) {
let mut embed = embed.body.split('|');
if let (Some(kind), Some(args)) = (embed.next(), embed.next()) {
if let Some((kind, args)) = embed.body.split_once('|') {
return Some(Self::new(kind.to_string(), args.to_string()));
}
}
Expand Down Expand Up @@ -80,4 +79,9 @@ mod tests {
))
);
}

#[test]
fn failed_deserialize() {
assert_eq!(Embed::deserialize_with_context("{{youtube}}", None), None);
}
}

0 comments on commit 93b8ba8

Please sign in to comment.