feat: improve HTML to String a bit

main
Henrik Böving 2021-12-12 13:18:24 +01:00
parent c2da7afd76
commit 413a24da56
1 changed files with 0 additions and 1 deletions

View File

@ -33,7 +33,6 @@ def attributesToString (attrs : Array (String × String)) :String :=
-- TODO: Termination proof -- TODO: Termination proof
partial def toStringAux : Html → String partial def toStringAux : Html → String
| element tag attrs #[] => s!"<{tag}{attributesToString attrs}/>\n"
| element tag attrs #[text s] => s!"<{tag}{attributesToString attrs}>{s}</{tag}>\n" | element tag attrs #[text s] => s!"<{tag}{attributesToString attrs}>{s}</{tag}>\n"
| element tag attrs #[child] => s!"<{tag}{attributesToString attrs}>\n{child.toStringAux}</{tag}>\n" | element tag attrs #[child] => s!"<{tag}{attributesToString attrs}>\n{child.toStringAux}</{tag}>\n"
| element tag attrs children => s!"<{tag}{attributesToString attrs}>\n{children.foldl (· ++ toStringAux ·) ""}</{tag}>\n" | element tag attrs children => s!"<{tag}{attributesToString attrs}>\n{children.foldl (· ++ toStringAux ·) ""}</{tag}>\n"