adam@9: (** Safe HTML parsing *)
adam@9:
adam@9: con attribute = fn t => {Nam : string,
adam@9: Parse : string -> option t}
adam@9:
adam@9: con tag = fn ts => {Nam : string,
adam@9: Attributes : $(map attribute ts),
adam@9: Folder : folder ts,
adam@9: Construct : ctx ::: {Unit} -> [[Body] ~ ctx] => $ts
adam@9: -> xml ([Body] ++ ctx) [] [] -> xml ([Body] ++ ctx) [] []}
adam@9:
adam@9: val tag : use ::: {Type} -> ignore ::: {Type} -> [use ~ ignore] => folder use -> string
adam@9: -> $(map attribute use)
adam@9: -> (ctx ::: {Unit} -> [[Body] ~ ctx] => Basis.tag (use ++ ignore) ([Body] ++ ctx) ([Body] ++ ctx) [] [])
adam@9: -> tag use
adam@9:
adam@9: val simpleTag : ignore ::: {Type} -> string -> bodyTag ignore -> tag []
adam@9: val simpleTag' : use ::: {Type} -> ignore ::: {Type} -> [use ~ ignore] => folder use
adam@9: -> string -> bodyTag (use ++ ignore) -> $(map attribute use) -> tag use
adam@9:
adam@9: val url : string -> attribute url
adam@9:
adam@9: val format : tags ::: {{Type}} -> folder tags -> $(map tag tags)
adam@9: -> ctx ::: {Unit} -> [[Body] ~ ctx] => string
adam@9: -> Parse.parse (xml ([Body] ++ ctx) [] [])
adam@9:
adam@9: val b : tag []
adam@9: val i : tag []
adam@9: val a : tag [Href = url]