Cleanup some code
This commit is contained in:
@ -56,7 +56,7 @@ defmodule Outlook.InternalTree.RawInternalBasic do
|
|||||||
Logger.info "inline_tree #{inline_tree |> inspect}"
|
Logger.info "inline_tree #{inline_tree |> inspect}"
|
||||||
partition_inlinelevel(inline_tree)
|
partition_inlinelevel(inline_tree)
|
||||||
|> chunk_with_list()
|
|> chunk_with_list()
|
||||||
|> Html.strip_attributes # to be implemented
|
|> Html.strip_attributes
|
||||||
|> Enum.map(fn sentence ->
|
|> Enum.map(fn sentence ->
|
||||||
%TranslationUnit{
|
%TranslationUnit{
|
||||||
content: Html.to_html(sentence),
|
content: Html.to_html(sentence),
|
||||||
|
|||||||
@ -5,13 +5,11 @@ defmodule Outlook.InternalTreeTest do
|
|||||||
|
|
||||||
describe "internal_tree" do
|
describe "internal_tree" do
|
||||||
alias Outlook.InternalTree
|
alias Outlook.InternalTree
|
||||||
alias Outlook.InternalTree.{InternalNode,Html,Basic,TranslationUnit}
|
alias Outlook.InternalTree.{InternalNode,TranslationUnit}
|
||||||
|
|
||||||
import Outlook.ArticlesFixtures
|
|
||||||
|
|
||||||
@default_uuid "11111111-1111-1111-1111-111111111111"
|
@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 = [
|
tree = [
|
||||||
%InternalNode{
|
%InternalNode{
|
||||||
name: "p",
|
name: "p",
|
||||||
@ -79,14 +77,19 @@ defmodule Outlook.InternalTreeTest do
|
|||||||
eph: %{sibling_with: :block}
|
eph: %{sibling_with: :block}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
assert InternalTree.partition_text(tree) |> unify_uuids_in_tunits() == [
|
assert InternalTree.partition_text(tree) |> unify_uuids_in_tunits() == [
|
||||||
%InternalNode{name: "p", attributes: %{}, type: :element, uuid: "8293da39-18e3-4695-8ec5-a3a4a06f006c",
|
%InternalNode{name: "p", attributes: %{}, type: :element, uuid: "8293da39-18e3-4695-8ec5-a3a4a06f006c",
|
||||||
content: [
|
content: [
|
||||||
%TranslationUnit{status: :untranslated, uuid: @default_uuid,
|
%TranslationUnit{status: :untranslated, uuid: @default_uuid,
|
||||||
content: "A sentence with many letters <a href=\"dingsda.com\">and many, many <b>words. </b></a>"},
|
content: "A sentence with many letters <a href=\"dingsda.com\">and many, many <b>words. </b></a>"},
|
||||||
%TranslationUnit{status: :untranslated, uuid: @default_uuid,
|
%TranslationUnit{status: :untranslated, uuid: @default_uuid,
|
||||||
content: "<a href=\"dingsda.com\"><b>A</b> sentence</a> with many letters and many, many words. "}],
|
content: "<a href=\"dingsda.com\"><b>A</b> sentence</a> with many letters and many, many words. "}
|
||||||
eph: %{sibling_with: :block}}]
|
],
|
||||||
|
eph: %{sibling_with: :block}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
test "partition_text/1 doesn't split numbers and abbreviated names" do
|
test "partition_text/1 doesn't split numbers and abbreviated names" do
|
||||||
tree = [
|
tree = [
|
||||||
|
|||||||
Reference in New Issue
Block a user