added clone derives and made the separating space mandatory in links with paths

This commit is contained in:
Michal Budzynski 2017-08-01 13:16:47 +02:00 committed by Michał Budzyński
parent d7ecb1a80c
commit ee29b9d5f6
1 changed files with 3 additions and 3 deletions

View File

@ -22,14 +22,14 @@ pub fn replace_all<P: AsRef<Path>>(s: &str, path: P) -> Result<String> {
Ok(replaced) Ok(replaced)
} }
#[derive(PartialOrd, PartialEq, Debug)] #[derive(PartialOrd, PartialEq, Debug, Clone)]
enum LinkType<'a> { enum LinkType<'a> {
Escaped, Escaped,
Include(PathBuf), Include(PathBuf),
Playpen(PathBuf, Vec<&'a str>), Playpen(PathBuf, Vec<&'a str>),
} }
#[derive(PartialOrd, PartialEq, Debug)] #[derive(PartialOrd, PartialEq, Debug, Clone)]
struct Link<'a> { struct Link<'a> {
start_index: usize, start_index: usize,
end_index: usize, end_index: usize,
@ -110,7 +110,7 @@ fn find_links(contents: &str) -> LinkIter {
| # or | # or
\{\{\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();