Skip to content

Commit

Permalink
Create pad increase values on compile time
Browse files Browse the repository at this point in the history
  • Loading branch information
ypconstante committed Aug 31, 2024
1 parent 97d1015 commit 29da59e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/floki/raw_html.ex
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@ defmodule Floki.RawHTML do

defp pad_increase(@noop), do: @noop

for depth <- 0..100 do
@current_pad String.duplicate(" ", depth * @pad_increase)
@next_pad String.duplicate(" ", depth * @pad_increase + @pad_increase)
defp pad_increase(@current_pad), do: @next_pad
end

defp pad_increase(pad) do
String.duplicate(" ", byte_size(pad) + @pad_increase)
end
Expand Down

0 comments on commit 29da59e

Please sign in to comment.