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

View file

@ -22,14 +22,14 @@ pub fn replace_all<P: AsRef<Path>>(s: &str, path: P) -> Result<String> {
Ok(replaced)
}
#[derive(PartialOrd, PartialEq, Debug)]
#[derive(PartialOrd, PartialEq, Debug, Clone)]
enum LinkType<'a> {
Escaped,
Include(PathBuf),
Playpen(PathBuf, Vec<&'a str>),
}
#[derive(PartialOrd, PartialEq, Debug)]
#[derive(PartialOrd, PartialEq, Debug, Clone)]
struct Link<'a> {
start_index: usize,
end_index: usize,
@ -110,7 +110,7 @@ fn find_links(contents: &str) -> LinkIter {
| # or
\{\{\s* # link opening parens and whitespace
\#([a-zA-Z0-9]+) # link type
\s* # separating whitespace
\s+ # separating whitespace
([a-zA-Z0-9\s_.\-:/\\]+) # link target path and space separated properties
\s*\}\} # whitespace and link closing parens
").unwrap();