Skip to content

Commit

Permalink
Flatten correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
danschultzer committed Apr 25, 2018
1 parent b50bbd8 commit fb1bbbc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/premailex/html_to_plain_text.ex
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,10 @@ defmodule Premailex.HTMLToPlainText do
|> Enum.join(" ")
end

defp flatten_table_body(list) when is_list(list), do: Enum.map(list, &flatten_table_body/1)
defp flatten_table_body({"tbody", [], table_cells}), do: table_cells
defp flatten_table_body(elem), do: elem
defp flatten_table_body(elements), do: Enum.flat_map(elements, &remove_tbody/1)

defp remove_tbody({"tbody", [], table_cells}), do: table_cells
defp remove_tbody(elem), do: [elem]

defp wordwrap(text) do
text
Expand Down

0 comments on commit fb1bbbc

Please sign in to comment.