diff --git a/lib/outlook/html_preparations/html_preparation.ex b/lib/outlook/html_preparations/html_preparation.ex
index 1536ba1..66c76be 100644
--- a/lib/outlook/html_preparations/html_preparation.ex
+++ b/lib/outlook/html_preparations/html_preparation.ex
@@ -3,8 +3,9 @@ defmodule Outlook.HtmlPreparations.HtmlPreparation do
alias Outlook.InternalTree.InternalNode
- @block_elements ["address","article","aside","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","li","main","nav","noscript","ol","p","pre","section","table","tfoot","ul","video"]
- # @inline_elements ["a","abbr","acronym","b","bdo","big","br","button","cite","code","dfn","em","i","img","input","kbd","label","map","object","output","q","samp","script","select","small","span","strong","sub","sup","textarea","time","tt","u","var"]
+ # treating img as block element because inline images are not desirable
+ @block_elements ~w(img address article aside blockquote canvas dd div dl dt fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 header hr li main nav noscript ol p pre section table tfoot ul video)
+ # @inline_elements ~w(a abbr acronym b bdo big br button cite code dfn em i input kbd label map object output q samp script select small span strong sub sup textarea time tt u var)
defp clean_atts_to_map(atts) do
atts_to_keep = ~w(href src)
@@ -46,6 +47,13 @@ defmodule Outlook.HtmlPreparations.HtmlPreparation do
def floki_to_internal([]), do: []
+ def set_sibling_with([ node | rest ]) when node.name == "a" do
+ [ %InternalNode{ node |
+ eph: %{sibling_with: :both}, # may occur at block level (e.g. when enclosing an
)
+ content: set_sibling_with(node.content)
+ } | set_sibling_with(rest) ]
+ end
+
def set_sibling_with([ %{type: :element} = node | rest ]) do
[ %InternalNode{ node |
eph: %{sibling_with: node.name in @block_elements && :block || :inline},