Skip to content

Commit

Permalink
Avoid interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jul 8, 2023
1 parent 60dfb45 commit 5eb1f00
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/ex_doc/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,14 @@ defmodule ExDoc.Utils do
do: to_json_string(rest, <<acc::binary, "\\\"">>)

defp to_json_string(<<x, rest::binary>>, acc) when x <= 0x000F,
do: to_json_string(rest, <<acc::binary, "\\u000#{Integer.to_string(x, 16)}">>)
do: to_json_string(rest, <<acc::binary, "\\u000", Integer.to_string(x, 16)::binary>>)

defp to_json_string(<<x, rest::binary>>, acc) when x <= 0x001F,
do: to_json_string(rest, <<acc::binary, "\\u00#{Integer.to_string(x, 16)}">>)
do: to_json_string(rest, <<acc::binary, "\\u00", Integer.to_string(x, 16)::binary>>)

defp to_json_string(<<x, rest::binary>>, acc),
do: to_json_string(rest, <<acc::binary, x>>)

defp to_json_string(<<x, rest::binary>>, acc), do: to_json_string(rest, <<acc::binary, x>>)
defp to_json_string(<<>>, acc), do: <<acc::binary, "\"">>

@doc """
Expand Down

0 comments on commit 5eb1f00

Please sign in to comment.