Add hyphenation and a generalized render_public_content function
This commit is contained in:
@ -2,6 +2,7 @@ defmodule Outlook.InternalTree do
|
||||
|
||||
alias Outlook.InternalTree.{Html,Modifiers,RawInternalBasic,InternalTree,Translation}
|
||||
alias Outlook.HtmlPreparations.HtmlPreparation
|
||||
alias Outlook.{Hyphenation, Translations}
|
||||
|
||||
def render_html(tree) do
|
||||
tree
|
||||
@ -55,11 +56,24 @@ defmodule Outlook.InternalTree do
|
||||
Translation.render_translation(tree, translation)
|
||||
end
|
||||
|
||||
def legacy_export(tree, translation) do
|
||||
content= Translation.render_translation(tree, translation)
|
||||
def render_public_content(tree, translation, language) do
|
||||
Translation.render_translation(tree, translation)
|
||||
|> Html.render_doc()
|
||||
|> Hyphenation.hyphenate(language)
|
||||
end
|
||||
|
||||
def legacy_export(translation_id) do
|
||||
translation = Translations.get_translation!(translation_id)
|
||||
content= Translation.render_translation(translation.article.content, translation.content)
|
||||
|> garnish(%{tunits: %{class: "ttrans", "data-ttrans-status": fn n -> Map.get(n, :status) end}})
|
||||
|> Html.render_doc
|
||||
|> Hyphenation.hyphenate(translation.language)
|
||||
IO.puts "writing export.html to #{File.cwd!}"
|
||||
File.write("export.html", content)
|
||||
end
|
||||
|
||||
def get_tunit_ids(tree) do
|
||||
InternalTree.collect_tunit_ids(tree)
|
||||
# |> List.flatten()
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user