39 lines
947 B
Elixir
39 lines
947 B
Elixir
defmodule Outlook.InternalTree do
|
|
|
|
alias Outlook.InternalTree.{Html,Modifiers,RawInternalBasic,InternalTree}
|
|
alias Outlook.HtmlPreparations.HtmlPreparation
|
|
|
|
def render_html(tree) do
|
|
tree
|
|
|> HtmlPreparation.strip_whitespace_textnodes()
|
|
|> Html.to_html()
|
|
end
|
|
|
|
def render_html_preview(tree, target \\ "1") do
|
|
tree
|
|
|> Html.to_html_preview(target)
|
|
end
|
|
|
|
require Logger
|
|
def apply_modifier(tree, modifier, uuids, opts \\ %{}) do
|
|
# Logger.info modifier
|
|
Modifiers.traverse_tree(tree, modifier, uuids, opts)
|
|
end
|
|
|
|
def partition_text(tree) do
|
|
# validate_sibling_collocation(tree)
|
|
tree
|
|
|> RawInternalBasic.set_split_markers()
|
|
|> RawInternalBasic.partition_to_tunits()
|
|
end
|
|
|
|
def garnish(tree, options) do
|
|
options = Enum.reduce(
|
|
~w(el_ids el_names tu_ids)a,
|
|
options,
|
|
fn prop, opts -> Map.put_new(opts, prop, []) end
|
|
)
|
|
InternalTree.garnish(tree, options)
|
|
end
|
|
end
|