Merge pull request #1208 from uint/links-preprocessor-support-pluses
#1098 Links preprocessor: support pluses
This commit is contained in:
commit
17210b058f
|
@ -370,7 +370,7 @@ fn find_links(contents: &str) -> LinkIter<'_> {
|
||||||
\{\{\s* # link opening parens and whitespace
|
\{\{\s* # link opening parens and whitespace
|
||||||
\#([a-zA-Z0-9_]+) # link type
|
\#([a-zA-Z0-9_]+) # link type
|
||||||
\s+ # separating whitespace
|
\s+ # separating whitespace
|
||||||
([a-zA-Z0-9\s_.\-:/\\]+) # link target path and space separated properties
|
([a-zA-Z0-9\s_.\-:/\\\+]+) # link target path and space separated properties
|
||||||
\s*\}\} # whitespace and link closing parens"
|
\s*\}\} # whitespace and link closing parens"
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -451,6 +451,24 @@ mod tests {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_find_links_with_special_characters() {
|
||||||
|
let s = "Some random text with {{#playpen foo-bar\\baz/_c++.rs}}...";
|
||||||
|
|
||||||
|
let res = find_links(s).collect::<Vec<_>>();
|
||||||
|
println!("\nOUTPUT: {:?}\n", res);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
res,
|
||||||
|
vec![Link {
|
||||||
|
start_index: 22,
|
||||||
|
end_index: 54,
|
||||||
|
link_type: LinkType::Playpen(PathBuf::from("foo-bar\\baz/_c++.rs"), vec![]),
|
||||||
|
link_text: "{{#playpen foo-bar\\baz/_c++.rs}}",
|
||||||
|
},]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_find_links_with_range() {
|
fn test_find_links_with_range() {
|
||||||
let s = "Some random text with {{#include file.rs:10:20}}...";
|
let s = "Some random text with {{#include file.rs:10:20}}...";
|
||||||
|
|
Loading…
Reference in New Issue