mirror of
https://github.com/rust-lang/mdBook
synced 2024-12-14 06:42:35 +00:00
added clone derives and made the separating space mandatory in links with paths
This commit is contained in:
parent
d7ecb1a80c
commit
ee29b9d5f6
1 changed files with 3 additions and 3 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue