Fix issue with end of sentence 'disguised' by markup
This commit is contained in:
@ -62,6 +62,7 @@ defmodule Outlook.InternalTree.RawInternalBasic do
|
||||
}
|
||||
end
|
||||
)
|
||||
|> strip_empty_tunits()
|
||||
end
|
||||
|
||||
def partition_inlinelevel([ %InternalNode{type: :element} = node | rest ]) do
|
||||
@ -73,7 +74,7 @@ defmodule Outlook.InternalTree.RawInternalBasic do
|
||||
|
||||
def partition_inlinelevel([ %InternalNode{type: :text} = textnode | rest ]) do
|
||||
content = if String.contains?(textnode.content, @splitmarker) do
|
||||
String.split(textnode.content, @splitmarker, trim: true)
|
||||
String.split(textnode.content, @splitmarker, trim: false)
|
||||
|> Enum.map(fn cont -> %InternalNode{textnode | content: cont} end)
|
||||
else
|
||||
textnode
|
||||
@ -89,6 +90,22 @@ defmodule Outlook.InternalTree.RawInternalBasic do
|
||||
def partition_inlinelevel([]), do: []
|
||||
|
||||
|
||||
def strip_empty_tunits([ %TranslationUnit{content: ""} | rest]) do
|
||||
strip_empty_tunits(rest)
|
||||
end
|
||||
|
||||
def strip_empty_tunits([ %{type: :element} = node | rest]) do
|
||||
[ %InternalNode{ node | content: strip_empty_tunits(node.content) }
|
||||
| strip_empty_tunits(rest) ]
|
||||
end
|
||||
|
||||
def strip_empty_tunits([ node | rest]) do
|
||||
[ node | strip_empty_tunits(rest) ]
|
||||
end
|
||||
|
||||
def strip_empty_tunits([]), do: []
|
||||
|
||||
|
||||
@doc """
|
||||
iex> chunk_with_list([1, 1, [2, 2], 3, 3, [4, 4, 4], 5, 5])
|
||||
[[1, 1, 2], [2, 3, 3, 4], [4], [4, 5, 5]]
|
||||
|
||||
Reference in New Issue
Block a user