Fix metadata parsing for images

pull/1/head
trivernis 5 years ago
parent 018960db0e
commit 5dc26612d6

2
Cargo.lock generated

@ -358,7 +358,7 @@ dependencies = [
[[package]] [[package]]
name = "snekdown" name = "snekdown"
version = "0.5.1" version = "0.5.2"
dependencies = [ dependencies = [
"chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",

@ -1,6 +1,6 @@
[package] [package]
name = "snekdown" name = "snekdown"
version = "0.5.1" version = "0.5.2"
authors = ["trivernis <trivernis@protonmail.com>"] authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018" edition = "2018"
license-file = "LICENSE" license-file = "LICENSE"

@ -549,7 +549,7 @@ impl Parser {
if self.check_special(&META_CLOSE) { if self.check_special(&META_CLOSE) {
let _ = self.next_char(); let _ = self.next_char();
} }
if self.check_linebreak() || values.len() == 0 { if values.len() == 0 {
// if there was a linebreak (the metadata wasn't closed) or there is no inner data // if there was a linebreak (the metadata wasn't closed) or there is no inner data
// return an error // return an error
return Err(self.revert_with_error(start_index)); return Err(self.revert_with_error(start_index));
@ -978,9 +978,6 @@ impl Parser {
} }
if let Ok(url) = self.parse_url(true) { if let Ok(url) = self.parse_url(true) {
let metadata = if let Ok(meta) = self.parse_inline_metadata() { let metadata = if let Ok(meta) = self.parse_inline_metadata() {
if self.check_special(&META_CLOSE) && self.next_char() == None {
return Err(self.revert_with_error(start_index));
}
Some(meta) Some(meta)
} else { } else {
None None

Loading…
Cancel
Save