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