Fix #402.
Unified · Split
| @@ -85,5 +85,9 @@ module Docs · 84 unmodified lines | ||
| 85 | 85 | |
| 86 | 86 | URI.decode(result) |
| 87 | 87 | end |
| 88 | + | |
| 89 | + def clean_path(path) | |
| 90 | + path.gsub %r{[!;:]+}, '-' | |
| 91 | + end | |
| 88 | 92 | end |
| 89 | 93 | end |
| @@ -81,6 +81,7 @@ module Docs · 80 unmodified lines | ||
| 81 | 81 | def internal_path_to(url) |
| 82 | 82 | url = index_url if url == root_url |
| 83 | 83 | path = effective_url.relative_path_to(url) |
| 84 | + path = clean_path(path) if context[:decode_and_clean_paths] | |
| 84 | 85 | URL.new(path: path, query: url.query, fragment: url.fragment).to_s |
| 85 | 86 | end |
| 86 | 87 | |
| @@ -37,7 +37,7 @@ module Docs · 36 unmodified lines | ||
| 37 | 37 | |
| 38 | 38 | if context[:decode_and_clean_paths] |
| 39 | 39 | path = URI.unescape(path) |
| 40 | − path.gsub! %r{[!;:]+}, '-' | |
| 40 | + path = clean_path(path) | |
| 41 | 41 | end |
| 42 | 42 | |
| 43 | 43 | if path == '.' |