Files
phoenix-ausblick/lib/outlook/internal_tree.ex
Thelonius Kort b48274eaef Add :eph field to %TranslationUnit{} and remove :sibling_with
Using :eph from now on to store ephemeral data like :sibling_with. Additionally
added cleaning up :eph before saving to db. And renamed InternalTree.Basic
to InternalTree.RawInternalBasic to make clear that it contains function
for an intermediary tree structure.
2022-12-29 22:09:26 +01:00

30 lines
697 B
Elixir

defmodule Outlook.InternalTree do
alias Outlook.InternalTree.{Html,Modifiers,RawInternalBasic}
alias Outlook.HtmlPreparations.HtmlPreparation
def render_html(tree) do
tree
|> HtmlPreparation.strip_whitespace_textnodes()
|> Html.to_html()
end
def render_html_preview(tree) do
tree
|> Html.to_html_preview("1")
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_textnodes()
end
end