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:
Trevor 2013-11-05 12:49:29 +11:00 committed by Trev
parent 5a742b8584
commit 501d4216c8

View File

@ -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 {
}
}
}
}
}