annotate html.urs @ 9:8eaaca74a64c

Import HTML parser
author Adam Chlipala <adam@chlipala.net>
date Wed, 15 Dec 2010 09:27:46 -0500
parents
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]