diff options
author | Henrik Nord <[email protected]> | 2011-09-28 15:00:19 +0200 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2011-09-28 15:02:54 +0200 |
commit | ae097a5161b79f16f8b9a2d8f73e5e2f1792edec (patch) | |
tree | cbf278b965e5ad7fbe95bea524ea9580c2942684 /lib/edoc/src/edoc_lib.erl | |
parent | fde38fa8d3120e6aa479f7720654114df9cd4ec8 (diff) | |
parent | df2063c1e436cfb2bb9283df074c4eaa87aeec91 (diff) | |
download | otp-ae097a5161b79f16f8b9a2d8f73e5e2f1792edec.tar.gz otp-ae097a5161b79f16f8b9a2d8f73e5e2f1792edec.tar.bz2 otp-ae097a5161b79f16f8b9a2d8f73e5e2f1792edec.zip |
Merge branch 'rc/edoc-0.7.9' into dev
* rc/edoc-0.7.9:
bumped revision
removed some never-matching clauses reported by dialyzer
Fix macro expansion in comments following Erlang types
URI-escape bytes as two hex digits always (reported by Alfonso De Gregorio)
updated author e-mail
recognize some more URI schemas in wiki text, in particular https
OTP-9590
Diffstat (limited to 'lib/edoc/src/edoc_lib.erl')
-rw-r--r-- | lib/edoc/src/edoc_lib.erl | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/edoc/src/edoc_lib.erl b/lib/edoc/src/edoc_lib.erl index 6c698e83ef..7fd8358add 100644 --- a/lib/edoc/src/edoc_lib.erl +++ b/lib/edoc/src/edoc_lib.erl @@ -15,7 +15,7 @@ %% USA %% %% @copyright 2001-2003 Richard Carlsson -%% @author Richard Carlsson <[email protected]> +%% @author Richard Carlsson <[email protected]> %% @see edoc %% @end %% ===================================================================== @@ -403,8 +403,13 @@ escape_uri([C | Cs]) -> escape_uri([]) -> []. -escape_byte(C) -> - "%" ++ hex_octet(C). +escape_byte(C) when C >= 0, C =< 255 -> + [$%, hex_digit(C bsr 4), hex_digit(C band 15)]. + +hex_digit(N) when N >= 0, N =< 9 -> + N + $0; +hex_digit(N) when N > 9, N =< 15 -> + N + $a - 10. % utf8([C | Cs]) when C > 16#7f -> % [((C band 16#c0) bsr 6) + 16#c0, C band 16#3f ++ 16#80 | utf8(Cs)]; @@ -413,13 +418,6 @@ escape_byte(C) -> % utf8([]) -> % []. -hex_octet(N) when N =< 9 -> - [$0 + N]; -hex_octet(N) when N > 15 -> - hex_octet(N bsr 4) ++ hex_octet(N band 15); -hex_octet(N) -> - [N - 10 + $a]. - %% Please note that URI are *not* file names. Don't use the stdlib %% 'filename' module for operations on (any parts of) URI. |