mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
Fix/support dash in relative links
Currently if you go had something like this: `[Some Link](../)` and you were in `http://devsite.dev/dev/docs/my_module/en/server-setup/location-specific/` The parser will resolve the link as: `http://devsite.dev/dev/docs/my_module/en/server-setup/location-` This is because the regex is only matching *Any word character (letter, number, underscore)*. I've added the dash.
This commit is contained in:
parent
5a742b8584
commit
501d4216c8
@ -388,7 +388,7 @@ class DocumentationParser {
|
||||
|
||||
// Resolve relative paths
|
||||
while(strpos($relativeUrl, '..') !== FALSE) {
|
||||
$relativeUrl = preg_replace('/\w+\/\.\.\//', '', $relativeUrl);
|
||||
$relativeUrl = preg_replace('/[-\w]+\/\.\.\//', '', $relativeUrl);
|
||||
}
|
||||
|
||||
// Replace any double slashes (apart from protocol)
|
||||
@ -428,4 +428,4 @@ class DocumentationParser {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user