File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -3,15 +3,14 @@ unit module Pod::Htmlify;
3
3
use URI::Escape;
4
4
5
5
# | Escape special characters in URLs if necessary
6
- sub url-munge ($ _ ) is export {
7
- return $ _ if m { ^ < [ a..z ] > + '://' };
8
- return " /type/ { uri_escape $ _ } " if m / ^ < [ A..Z ] > /;
9
- return " /routine/ { uri_escape $ _ } " if m /^ <[ a..z ] > | ^ < - alpha > * $ /;
10
- # poor man's <identifier>
11
- if m / ^ '&' ( \w <[ [\w'- ] >* ) $ / {
12
- return " /routine/ { uri_escape $0 } " ;
6
+ sub url-munge ($ url ) is export {
7
+ given $ url {
8
+ when m { ^ < [ a..z ] > + '://' } { $ _ }
9
+ when m /^ <[ A..Z ] > / { " /type/ { uri_escape $ _ } " }
10
+ when m / ^ < [ a..z ] > | ^ < - alpha > * $ / { " /routine/ { uri_escape $ _ } " }
11
+ when m / ^ '&' ( \w <[ [\w'- ] >* ) $ / { " /routine/ { uri_escape $0 } " } # poor man's <identifier>
12
+ default { $ _ }
13
13
}
14
- return $ _ ;
15
14
}
16
15
17
16
constant badchars = qw [ $ / \ . % ? & = # + " ' : ~ < > | ] ;
You can’t perform that action at this time.
0 commit comments