diff --git a/Cargo.lock b/Cargo.lock index 8f8c730..116c3f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -235,9 +235,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "charred" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e01302bf6a3d92a90baa965f84a735938520ab9fd896f0694a71e8dec5405ce" +checksum = "0d76bd26a00789c7e782d3ba5c0adae6f7eabc2a1026dfb41838b0e11ebf55f8" [[package]] name = "chrono" diff --git a/Cargo.toml b/Cargo.toml index 2f5ef55..7494436 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ path = "src/main.rs" pdf = ["headless_chrome", "failure"] [dependencies] -charred = "0.3.3" +charred = "0.3.4" asciimath-rs = "0.5.7" bibliographix = "0.6.0" crossbeam-utils = "0.7.2" diff --git a/src/parser/inline.rs b/src/parser/inline.rs index 2665307..aa7bcaf 100644 --- a/src/parser/inline.rs +++ b/src/parser/inline.rs @@ -6,6 +6,7 @@ use crate::parser::block::ParseBlock; use crate::references::glossary::GlossaryDisplay; use crate::references::glossary::GlossaryReference; use crate::references::templates::{GetTemplateVariables, Template, TemplateVariable}; +use crate::utils::parsing::remove_single_backlslash; use crate::Parser; use bibliographix::references::bib_reference::BibRef; use parking_lot::Mutex; @@ -295,9 +296,10 @@ impl ParseInline for Parser { let start_index = self.ctm.get_index(); self.ctm.assert_char(&BACKTICK, Some(start_index))?; self.ctm.seek_one()?; - let content = self - .ctm - .get_string_until_any_or_rewind(&[BACKTICK, LB], &[], start_index)?; + let mut content = + self.ctm + .get_string_until_any_or_rewind(&[BACKTICK, LB], &[], start_index)?; + content = remove_single_backlslash(content); self.ctm.assert_char(&BACKTICK, Some(start_index))?; self.ctm.seek_one()?; diff --git a/src/utils/image_converting.rs b/src/utils/image_converting.rs index 3f8a526..5cab906 100644 --- a/src/utils/image_converting.rs +++ b/src/utils/image_converting.rs @@ -60,7 +60,7 @@ impl ImageConverter { } pb.lock().tick(); }); - pb.lock().finish(); + pb.lock().finish_and_clear(); } } diff --git a/src/utils/parsing.rs b/src/utils/parsing.rs index d89de44..823ff74 100644 --- a/src/utils/parsing.rs +++ b/src/utils/parsing.rs @@ -1,6 +1,15 @@ +use regex::Regex; #[macro_export] macro_rules! parse { ($str:expr) => { Parser::new($str.to_string(), None).parse() }; } + +/// Removes a single backslash from the given content +pub(crate) fn remove_single_backlslash(content: S) -> String { + let content = content.to_string(); + lazy_static::lazy_static! {static ref R: Regex = Regex::new(r"\\(?P[^\\])").unwrap();} + + R.replace_all(&*content, "$c").to_string() +}