annotate html.urs @ 29:7530b2b54353

Update for Ur/Web's new type class handling
author Adam Chlipala <adam@chlipala.net>
date Sun, 29 Jul 2012 12:27:36 -0400
parents 8eaaca74a64c
children
rev   line source
adam@9 1 (** Safe HTML parsing *)
adam@9 2
adam@9 3 con attribute = fn t => {Nam : string,
adam@9 4 Parse : string -> option t}
adam@9 5
adam@9 6 con tag = fn ts => {Nam : string,
adam@9 7 Attributes : $(map attribute ts),
adam@9 8 Folder : folder ts,
adam@9 9 Construct : ctx ::: {Unit} -> [[Body] ~ ctx] => $ts
adam@9 10 -> xml ([Body] ++ ctx) [] [] -> xml ([Body] ++ ctx) [] []}
adam@9 11
adam@9 12 val tag : use ::: {Type} -> ignore ::: {Type} -> [use ~ ignore] => folder use -> string
adam@9 13 -> $(map attribute use)
adam@9 14 -> (ctx ::: {Unit} -> [[Body] ~ ctx] => Basis.tag (use ++ ignore) ([Body] ++ ctx) ([Body] ++ ctx) [] [])
adam@9 15 -> tag use
adam@9 16
adam@9 17 val simpleTag : ignore ::: {Type} -> string -> bodyTag ignore -> tag []
adam@9 18 val simpleTag' : use ::: {Type} -> ignore ::: {Type} -> [use ~ ignore] => folder use
adam@9 19 -> string -> bodyTag (use ++ ignore) -> $(map attribute use) -> tag use
adam@9 20
adam@9 21 val url : string -> attribute url
adam@9 22
adam@9 23 val format : tags ::: {{Type}} -> folder tags -> $(map tag tags)
adam@9 24 -> ctx ::: {Unit} -> [[Body] ~ ctx] => string
adam@9 25 -> Parse.parse (xml ([Body] ++ ctx) [] [])
adam@9 26
adam@9 27 val b : tag []
adam@9 28 val i : tag []
adam@9 29 val a : tag [Href = url]