diff --git a/lib/outlook/internal_tree/raw_internal_basic.ex b/lib/outlook/internal_tree/raw_internal_basic.ex index 63f347c..8bee3d5 100644 --- a/lib/outlook/internal_tree/raw_internal_basic.ex +++ b/lib/outlook/internal_tree/raw_internal_basic.ex @@ -56,7 +56,7 @@ defmodule Outlook.InternalTree.RawInternalBasic do Logger.info "inline_tree #{inline_tree |> inspect}" partition_inlinelevel(inline_tree) |> chunk_with_list() - |> Html.strip_attributes # to be implemented + |> Html.strip_attributes |> Enum.map(fn sentence -> %TranslationUnit{ content: Html.to_html(sentence), diff --git a/test/outlook/internaltree_test.exs b/test/outlook/internaltree_test.exs index 2bd6afc..84bb02b 100644 --- a/test/outlook/internaltree_test.exs +++ b/test/outlook/internaltree_test.exs @@ -5,13 +5,11 @@ defmodule Outlook.InternalTreeTest do describe "internal_tree" do alias Outlook.InternalTree - alias Outlook.InternalTree.{InternalNode,Html,Basic,TranslationUnit} - - import Outlook.ArticlesFixtures + alias Outlook.InternalTree.{InternalNode,TranslationUnit} @default_uuid "11111111-1111-1111-1111-111111111111" - test "partition_text/1 returns correctly dingens..." do + test "partition_text/1 returns correctly partitioned text without overlapping markup" do tree = [ %InternalNode{ name: "p", @@ -79,14 +77,19 @@ defmodule Outlook.InternalTreeTest do eph: %{sibling_with: :block} } ] + assert InternalTree.partition_text(tree) |> unify_uuids_in_tunits() == [ %InternalNode{name: "p", attributes: %{}, type: :element, uuid: "8293da39-18e3-4695-8ec5-a3a4a06f006c", content: [ %TranslationUnit{status: :untranslated, uuid: @default_uuid, content: "A sentence with many letters and many, many words. "}, %TranslationUnit{status: :untranslated, uuid: @default_uuid, - content: "A sentence with many letters and many, many words. "}], - eph: %{sibling_with: :block}}] + content: "A sentence with many letters and many, many words. "} + ], + eph: %{sibling_with: :block} + } + ] + end test "partition_text/1 doesn't split numbers and abbreviated names" do tree = [