src/Tools/WWW_Find/xhtml.ML
changeset 41491 a2ad5b824051
parent 41455 d3be2a414d15
child 43072 8aeb7ec8003a
equal deleted inserted replaced
41490:0f1e411a1448 41491:a2ad5b824051
   268 
   268 
   269 fun pre common_atts rt = Tag ("pre", from_common common_atts, [RawText rt]);
   269 fun pre common_atts rt = Tag ("pre", from_common common_atts, [RawText rt]);
   270 
   270 
   271 fun ostr_att (nm, NONE) = []
   271 fun ostr_att (nm, NONE) = []
   272   | ostr_att (nm, SOME s) = [(nm, s)];
   272   | ostr_att (nm, SOME s) = [(nm, s)];
   273 val oint_att = ostr_att o apsnd (Option.map Int.toString);
   273 val oint_att = ostr_att o apsnd (Option.map string_of_int);
   274 
   274 
   275 val table = tag' "table";
   275 val table = tag' "table";
   276 val thead = tag' "thead";
   276 val thead = tag' "thead";
   277 val tbody = tag' "tbody";
   277 val tbody = tag' "tbody";
   278 val tr = tag "tr" [];
   278 val tr = tag "tr" [];
   289 
   289 
   290 fun p (common_atts, t) = Tag ("p", from_common common_atts, [Text t]);
   290 fun p (common_atts, t) = Tag ("p", from_common common_atts, [Text t]);
   291 fun p' (common_atts, tags) = Tag ("p", from_common common_atts, tags);
   291 fun p' (common_atts, tags) = Tag ("p", from_common common_atts, tags);
   292 
   292 
   293 fun h (common_atts, i, text) =
   293 fun h (common_atts, i, text) =
   294   Tag ("h" ^ Int.toString i, from_common common_atts, [Text text]);
   294   Tag ("h" ^ string_of_int i, from_common common_atts, [Text text]);
   295 
   295 
   296 fun strong t = Tag ("strong", [], [Text t]);
   296 fun strong t = Tag ("strong", [], [Text t]);
   297 fun em t = Tag ("em", [], [Text t]);
   297 fun em t = Tag ("em", [], [Text t]);
   298 fun a { href, text } = Tag ("a", [("href", href)], [Text text]);
   298 fun a { href, text } = Tag ("a", [("href", href)], [Text text]);
   299 
   299 
   339       ("type", "text")
   339       ("type", "text")
   340        :: ostr_att ("value", value)
   340        :: ostr_att ("value", value)
   341         @ oint_att ("maxlength", maxlength)
   341         @ oint_att ("maxlength", maxlength)
   342   | input_atts (Password NONE) = [("type", "password")]
   342   | input_atts (Password NONE) = [("type", "password")]
   343   | input_atts (Password (SOME i)) =
   343   | input_atts (Password (SOME i)) =
   344       [("type", "password"), ("maxlength", Int.toString i)]
   344       [("type", "password"), ("maxlength", string_of_int i)]
   345   | input_atts (Checkbox checked) =
   345   | input_atts (Checkbox checked) =
   346       ("type", "checkbox") :: from_checked checked
   346       ("type", "checkbox") :: from_checked checked
   347   | input_atts (Radio checked) = ("type", "radio") :: from_checked checked
   347   | input_atts (Radio checked) = ("type", "radio") :: from_checked checked
   348   | input_atts Submit = [("type", "submit")]
   348   | input_atts Submit = [("type", "submit")]
   349   | input_atts Reset = [("type", "reset")]
   349   | input_atts Reset = [("type", "reset")]