```
This commit is contained in:
parent
1b8614b956
commit
e4b08b45bc
@ -9,3 +9,4 @@ regex = "1.11.1"
|
|||||||
url = "2.5.4"
|
url = "2.5.4"
|
||||||
termion = "4.0.3"
|
termion = "4.0.3"
|
||||||
open = "5.3.2"
|
open = "5.3.2"
|
||||||
|
url = "2.5.4"
|
||||||
|
@ -83,7 +83,7 @@ fn parse_markdown(page_content: String) -> (String, Vec<String>) {
|
|||||||
}).to_string();
|
}).to_string();
|
||||||
|
|
||||||
// Inline code
|
// Inline code
|
||||||
let inline_code_regex = Regex::new(r"`(.*?)`").unwrap();
|
let inline_code_regex = Regex::new(r"`([^`]+?)`").unwrap();
|
||||||
parsed_line = inline_code_regex.replace_all(&parsed_line, |caps: ®ex::Captures| {
|
parsed_line = inline_code_regex.replace_all(&parsed_line, |caps: ®ex::Captures| {
|
||||||
format!("{}", &caps[1].magenta())
|
format!("{}", &caps[1].magenta())
|
||||||
}).to_string();
|
}).to_string();
|
||||||
@ -120,7 +120,7 @@ fn parse_markdown(page_content: String) -> (String, Vec<String>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// multiline code
|
// multiline code
|
||||||
let multiline_code_regex = Regex::new(r"(?ms)%%%((.*?\n)+?)%%%").unwrap();
|
let multiline_code_regex = Regex::new(r"(?ms)```((.*?\n)+?)```").unwrap();
|
||||||
parsed_page_content = multiline_code_regex.replace_all(&parsed_page_content, |caps: ®ex::Captures| {
|
parsed_page_content = multiline_code_regex.replace_all(&parsed_page_content, |caps: ®ex::Captures| {
|
||||||
// Capture the code inside the %% blocks
|
// Capture the code inside the %% blocks
|
||||||
let code_block = &caps[1];
|
let code_block = &caps[1];
|
||||||
@ -218,7 +218,7 @@ fn parse_url(user_input: String, previous_host: &String) -> Result<Url, u8> {
|
|||||||
|
|
||||||
if let Some(caps) = mttp_regex.captures(&user_input) {
|
if let Some(caps) = mttp_regex.captures(&user_input) {
|
||||||
url.hostname = caps[1].to_string();
|
url.hostname = caps[1].to_string();
|
||||||
url.port = 3477;
|
url.port = 3477;
|
||||||
url.path = caps[2].to_string();
|
url.path = caps[2].to_string();
|
||||||
url.protocol = "mttp".to_string();
|
url.protocol = "mttp".to_string();
|
||||||
Ok(url)
|
Ok(url)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user