Fix escapes in monospace and progressbar

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/15/head
trivernis 4 years ago
parent d60e6aabd4
commit 8cf6dd33b7
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

4
Cargo.lock generated

@ -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"

@ -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"

@ -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()?;

@ -60,7 +60,7 @@ impl ImageConverter {
}
pb.lock().tick();
});
pb.lock().finish();
pb.lock().finish_and_clear();
}
}

@ -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<S: ToString>(content: S) -> String {
let content = content.to_string();
lazy_static::lazy_static! {static ref R: Regex = Regex::new(r"\\(?P<c>[^\\])").unwrap();}
R.replace_all(&*content, "$c").to_string()
}

Loading…
Cancel
Save