package tyxml
A library for building correct HTML and SVG documents
Install
Dune Dependency
Authors
Maintainers
Sources
tyxml-4.6.0.tbz
sha256=bfeb673c6b4e120a4eca4c48448add47dc3f8d02c2b40f63ffdccc4e91c902dd
sha512=69750eeaf467014282087bf9628f3278f3e5f00f4c7400358750d208664cfc3f79a5cba16767d2935e53477d1a6862fe08c5b801b69052ec12e09d1a93a5e9b4
doc/src/tyxml.functor/html_f.ml.html
Source file html_f.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142
(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2004 by Thorsten Ohl <ohl@physik.uni-wuerzburg.de> * Copyright (C) 2007 by Vincent Balat, Gabriel Kerneis * Copyright (C) 2010 by Cecile Herbelin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1301, USA. *) module Make_with_wrapped_functions (Xml : Xml_sigs.T) (C : Html_sigs.Wrapped_functions with module Xml = Xml) (Svg : Svg_sigs.T with module Xml := Xml) = struct module Xml = Xml module W = Xml.W module Info = struct let content_type = "text/html" let alternative_content_types = ["application/xhtml+xml";"application/xml";"text/xml"] let version = "HTML5-draft" let standard = "http://www.w3.org/TR/html5/" let namespace = "http://www.w3.org/1999/xhtml" let doctype = Xml_print.compose_doctype "html" [] let = [ "area"; "base"; "br"; "col"; "command"; "embed"; "hr"; "img"; "input"; "keygen"; "link"; "meta"; "param"; "source"; "wbr" ] end type 'a wrap = 'a W.t type 'a list_wrap = 'a W.tlist type uri = Xml.uri let string_of_uri = Xml.string_of_uri let uri_of_string = Xml.uri_of_string type image_candidate = [ `Url of uri | `Url_width of uri * Html_types.number | `Url_pixel of uri * Html_types.float_number ] type 'a attrib = Xml.attrib let to_xmlattribs x = x let to_attrib x = x (* VB *) let float_attrib = Xml.float_attrib let int_attrib = Xml.int_attrib let string_attrib = Xml.string_attrib let uri_attrib a s = Xml.uri_attrib a s let space_sep_attrib = Xml.space_sep_attrib let comma_sep_attrib = Xml.comma_sep_attrib let user_attrib f name v = Xml.string_attrib name (W.fmap f v) let bool_attrib = user_attrib C.string_of_bool let constant_attrib a () = string_attrib a (W.return a) let linktypes_attrib name x = user_attrib C.string_of_linktypes name x let mediadesc_attrib name x = user_attrib C.string_of_mediadesc name x let srcset_attrib name x = user_attrib C.string_of_srcset name x (* Core: *) let a_class = space_sep_attrib "class" let a_id = string_attrib "id" let a_user_data name = string_attrib ("data-" ^ name) let a_title = string_attrib "title" (* I18N: *) let a_xml_lang = string_attrib "xml:lang" let a_lang = string_attrib "lang" (* Style: *) let a_style = string_attrib "style" let a_property = string_attrib "property" (* Events: *) let a_onabort = Xml.event_handler_attrib "onabort" let a_onafterprint = Xml.event_handler_attrib "onafterprint" let a_onbeforeprint = Xml.event_handler_attrib "onbeforeprint" let a_onbeforeunload = Xml.event_handler_attrib "onbeforeunload" let a_onblur = Xml.event_handler_attrib "onblur" let a_oncanplay = Xml.event_handler_attrib "oncanplay" let a_oncanplaythrough = Xml.event_handler_attrib "oncanplaythrough" let a_onchange = Xml.event_handler_attrib "onchange" let a_onclose = Xml.event_handler_attrib "onclose" let a_ondurationchange = Xml.event_handler_attrib "ondurationchange" let a_onemptied = Xml.event_handler_attrib "onemptied" let a_onended = Xml.event_handler_attrib "onended" let a_onerror = Xml.event_handler_attrib "onerror" let a_onfocus = Xml.event_handler_attrib "onfocus" let a_onformchange = Xml.event_handler_attrib "onformchange" let a_onforminput = Xml.event_handler_attrib "onforminput" let a_onhashchange = Xml.event_handler_attrib "onhashchange" let a_oninput = Xml.event_handler_attrib "oninput" let a_oninvalid = Xml.event_handler_attrib "oninvalid" let a_onoffline = Xml.event_handler_attrib "onoffline" let a_ononline = Xml.event_handler_attrib "ononline" let a_onpause = Xml.event_handler_attrib "onpause" let a_onplay = Xml.event_handler_attrib "onplay" let a_onplaying = Xml.event_handler_attrib "onplaying" let a_onpagehide = Xml.event_handler_attrib "onpagehide" let a_onpageshow = Xml.event_handler_attrib "onpageshow" let a_onpopstate = Xml.event_handler_attrib "onpopstate" let a_onprogress = Xml.event_handler_attrib "onprogress" let a_onratechange = Xml.event_handler_attrib "onratechange" let a_onreadystatechange = Xml.event_handler_attrib "onreadystatechange" let a_onredo = Xml.event_handler_attrib "onredo" let a_onresize = Xml.event_handler_attrib "onresize" let a_onscroll = Xml.event_handler_attrib "onscroll" let a_onseeked = Xml.event_handler_attrib "onseeked" let a_onseeking = Xml.event_handler_attrib "onseeking" let a_onselect = Xml.event_handler_attrib "onselect" let a_onshow = Xml.event_handler_attrib "onshow" let a_onstalled = Xml.event_handler_attrib "onstalled" let a_onstorage = Xml.event_handler_attrib "onstorage" let a_onsubmit = Xml.event_handler_attrib "onsubmit" let a_onsuspend = Xml.event_handler_attrib "onsuspend" let a_ontimeupdate = Xml.event_handler_attrib "ontimeupdate" let a_onundo = Xml.event_handler_attrib "onundo" let a_onunload = Xml.event_handler_attrib "onunload" let a_onvolumechange = Xml.event_handler_attrib "onvolumechange" let a_onwaiting = Xml.event_handler_attrib "onwaiting" let a_onload = Xml.event_handler_attrib "onload" let a_onloadeddata = Xml.event_handler_attrib "onloadeddata" let a_onloadedmetadata = Xml.event_handler_attrib "onloadedmetadata" let a_onloadstart = Xml.event_handler_attrib "onloadstart" let a_onmessage = Xml.event_handler_attrib "onmessage" let a_onmousewheel = Xml.event_handler_attrib "onmousewheel" (** Javascript mouse events *) let a_onclick = Xml.mouse_event_handler_attrib "onclick" let = Xml.mouse_event_handler_attrib "oncontextmenu" let a_ondblclick = Xml.mouse_event_handler_attrib "ondblclick" let a_ondrag = Xml.mouse_event_handler_attrib "ondrag" let a_ondragend = Xml.mouse_event_handler_attrib "ondragend" let a_ondragenter = Xml.mouse_event_handler_attrib "ondragenter" let a_ondragleave = Xml.mouse_event_handler_attrib "ondragleave" let a_ondragover = Xml.mouse_event_handler_attrib "ondragover" let a_ondragstart = Xml.mouse_event_handler_attrib "ondragstart" let a_ondrop = Xml.mouse_event_handler_attrib "ondrop" let a_onmousedown = Xml.mouse_event_handler_attrib "onmousedown" let a_onmouseup = Xml.mouse_event_handler_attrib "onmouseup" let a_onmouseover = Xml.mouse_event_handler_attrib "onmouseover" let a_onmousemove = Xml.mouse_event_handler_attrib "onmousemove" let a_onmouseout = Xml.mouse_event_handler_attrib "onmouseout" (** Javascript touch events *) let a_ontouchstart = Xml.touch_event_handler_attrib "ontouchstart" let a_ontouchend = Xml.touch_event_handler_attrib "ontouchend" let a_ontouchmove = Xml.touch_event_handler_attrib "ontouchmove" let a_ontouchcancel = Xml.touch_event_handler_attrib "ontouchcancel" (** Javascript keyboard events *) let a_onkeypress = Xml.keyboard_event_handler_attrib "onkeypress" let a_onkeydown = Xml.keyboard_event_handler_attrib "onkeydown" let a_onkeyup = Xml.keyboard_event_handler_attrib "onkeyup" (* Other Attributes *) let a_version = string_attrib "version" let a_xmlns x = user_attrib C.string_of_big_variant "xmlns" x let a_manifest = uri_attrib "manifest" let a_cite = uri_attrib "cite" let a_xml_space x = user_attrib C.string_of_big_variant "xml:space" x let a_accesskey c = user_attrib C.string_of_character "accesskey" c let a_charset = string_attrib "charset" let a_accept_charset = space_sep_attrib "accept-charset" let a_accept = comma_sep_attrib "accept" let a_href = uri_attrib "href" let a_hreflang = string_attrib "hreflang" let a_download file = user_attrib (C.unoption_string) "download" file let a_rel = linktypes_attrib "rel" let a_tabindex = int_attrib "tabindex" let a_mime_type = string_attrib "type" let a_alt = string_attrib "alt" let a_height p = int_attrib "height" p let a_src = uri_attrib "src" let a_width p = int_attrib "width" p let a_label_for = string_attrib "for" let a_for = a_label_for let a_output_for = space_sep_attrib "for" let a_for_list = a_output_for let a_selected = constant_attrib "selected" let a_text_value = string_attrib "value" let a_int_value = int_attrib "value" let a_value = string_attrib "value" let a_float_value = float_attrib "value" let a_action = uri_attrib "action" let a_method x = user_attrib C.string_of_big_variant "method" x let a_formmethod x = user_attrib C.string_of_big_variant "formmethod" x let a_enctype = string_attrib "enctype" let a_checked = constant_attrib "checked" let a_disabled = constant_attrib "disabled" let a_readonly = constant_attrib "readonly" let a_maxlength = int_attrib "maxlength" let a_minlength = int_attrib "minlength" let a_name = string_attrib "name" let a_allowfullscreen = constant_attrib "allowfullscreen" let a_allowpaymentrequest = constant_attrib "allowpaymentrequest" let a_referrerpolicy x = user_attrib C.string_of_referrerpolicy "referrerpolicy" x let a_autocomplete x = user_attrib C.string_of_autocomplete "autocomplete" x let a_async = constant_attrib "async" let a_autofocus = constant_attrib "autofocus" let a_autoplay = constant_attrib "autoplay" let a_muted = constant_attrib "muted" let a_crossorigin x = user_attrib C.string_of_big_variant "crossorigin" x let a_integrity = string_attrib "integrity" let a_mediagroup = string_attrib "mediagroup" let a_challenge = string_attrib "challenge" let a_contenteditable ce = bool_attrib "contenteditable" ce let = string_attrib "contextmenu" let a_controls = constant_attrib "controls" let a_dir x = user_attrib C.string_of_big_variant "dir" x let a_draggable d = bool_attrib "draggable" d let a_form = string_attrib "form" let a_formaction = uri_attrib "formaction" let a_formenctype = string_attrib "formenctype" let a_formnovalidate = constant_attrib "formnovalidate" let a_formtarget = string_attrib "formtarget" let = constant_attrib "hidden" let a_high = float_attrib "high" let a_icon = uri_attrib "icon" let a_ismap = constant_attrib "ismap" let a_keytype = string_attrib "keytype" let a_list = string_attrib "list" let a_loop = constant_attrib "loop" let a_low = float_attrib "low" let a_max = float_attrib "max" let a_input_max = user_attrib C.string_of_number_or_datetime "max" let a_min = float_attrib "min" let a_input_min = user_attrib C.string_of_number_or_datetime "min" let a_inputmode x = user_attrib C.string_of_big_variant "inputmode" x let a_novalidate = constant_attrib "novalidate" let a_open = constant_attrib "open" let a_optimum = float_attrib "optimum" let a_pattern = string_attrib "pattern" let a_placeholder = string_attrib "placeholder" let a_poster = uri_attrib "poster" let a_preload x = user_attrib C.string_of_big_variant "preload" x let a_pubdate = constant_attrib "pubdate" let a_radiogroup = string_attrib "radiogroup" let a_required = constant_attrib "required" let a_reversed = constant_attrib "reserved" let a_sandbox x = user_attrib C.string_of_sandbox "sandbox" x let a_spellcheck sc = bool_attrib "spellcheck" sc let a_scoped = constant_attrib "scoped" let a_seamless = constant_attrib "seamless" let a_sizes sizes = user_attrib C.string_of_sizes "sizes" sizes let a_span = int_attrib "span" (*let a_srcdoc*) let a_srclang = string_attrib "xml:lang" let a_srcset = srcset_attrib "srcset" let a_img_sizes = comma_sep_attrib "sizes" let a_start = int_attrib "start" let a_step step = user_attrib C.string_of_step "step" step let a_translate x = user_attrib C.string_of_big_variant "translate" x let a_wrap x = user_attrib C.string_of_big_variant "wrap" x let a_size = int_attrib "size" let a_input_type it = user_attrib C.string_of_input_type "type" it let x = user_attrib C.string_of_big_variant "type" x let a_command_type x = user_attrib C.string_of_big_variant "type" x let bt = user_attrib C.string_of_input_type "type" bt let a_script_type sc = user_attrib C.string_of_script_type "type" sc let a_multiple = constant_attrib "multiple" let a_cols = int_attrib "cols" let a_rows = int_attrib "rows" let a_summary = string_attrib "summary" let a_align x = user_attrib C.string_of_big_variant "align" x let a_axis = string_attrib "axis" let a_colspan = int_attrib "colspan" let a_headers = space_sep_attrib "headers" let a_rowspan = int_attrib "rowspan" let a_scope x = user_attrib C.string_of_big_variant "scope" x let a_border = int_attrib "border" let a_rules x = user_attrib C.string_of_big_variant "rules" x let a_char c = user_attrib C.string_of_character "char" c let a_data = uri_attrib "data" let a_codetype = string_attrib "codetype" let a_frameborder x = user_attrib C.string_of_big_variant "frameborder" x let a_marginheight = int_attrib "marginheight" let a_marginwidth = int_attrib "marginwidth" let a_scrolling x = user_attrib C.string_of_big_variant "scrolling" x let a_target = string_attrib "target" let a_content = string_attrib "content" let a_http_equiv = string_attrib "http-equiv" let a_media = mediadesc_attrib "media" (* ARIA *) let a_role = space_sep_attrib "role" let a_aria name = space_sep_attrib ("aria-" ^ name) type 'a elt = Xml.elt type ('a, 'b) nullary = ?a: (('a attrib) list) -> unit -> 'b elt type ('a, 'b, 'c) unary = ?a: (('a attrib) list) -> 'b elt wrap -> 'c elt type ('a, 'b, 'c) star = ?a: (('a attrib) list) -> ('b elt) list_wrap -> 'c elt let terminal tag ?a () = Xml.leaf ?a tag let unary tag ?a elt = Xml.node ?a tag (W.singleton elt) let star tag ?a elts = Xml.node ?a tag elts let plus tag ?a elt elts = Xml.node ?a tag (W.cons elt elts) let option_cons opt elts = match opt with | None -> elts | Some x -> W.cons x elts let body = star "body" let head = plus "head" let title = unary "title" let html ?a head body = let content = W.cons head (W.singleton body) in Xml.node ?a "html" content let = star "footer" let header = star "header" let section = star "section" let = star "nav" let txt s = Xml.pcdata s let pcdata = txt let entity = Xml.entity let space () = entity "nbsp" let cdata = Xml.cdata let cdata_script = Xml.cdata_script let cdata_style = Xml.cdata_style let h1 = star "h1" let h2 = star "h2" let h3 = star "h3" let h4 = star "h4" let h5 = star "h5" let h6 = star "h6" let hgroup = star "hgroup" let address = star "address" let blockquote = star "blockquote" let dialog = star "dialog" let div = star "div" let p = star "p" let pre = star "pre" let abbr = star "abbr" let br = terminal "br" let cite = star "cite" let code = star "code" let dfn = star "dfn" let em = star "em" let kbd = star "kbd" let q = star "q" let samp = star "samp" let span = star "span" let strong = star "strong" let time = star "time" let var = star "var" let a = star "a" let dl = star "dl" let ol = star "ol" let ul = star "ul" let dd = star "dd" let dt = star "dt" let li = star "li" let hr = terminal "hr" let b = star "b" let i = star "i" let u = star "u" let small = star "small" let sub = star "sub" let sup = star "sup" let mark = star "mark" let rp = star "rp" let rt = star "rt" let ruby = star "ruby" let wbr = terminal "wbr" (* VB *) type shape = [ | `Rect | `Circle | `Poly | `Default ] let bdo ~dir ?(a = []) elts = Xml.node ~a: ((a_dir dir) :: a) "bdo" elts let a_datetime = string_attrib "datetime" let a_shape x = user_attrib C.string_of_big_variant "shape" x let a_coords coords = user_attrib C.string_of_numbers "coords" coords let a_usemap = string_attrib "usemap" let a_defer = constant_attrib "defer" let a_label = string_attrib "label" let area ~alt ?(a = []) () = Xml.leaf ~a: ((a_alt alt) :: a) "area" let map = star "map" let del = star "del" let ins = star "ins" let script = unary "script" let noscript = star "noscript" let template = star "template" let article = star "article" let aside = star "aside" let main = star "main" let video_audio name ?src ?srcs ?(a = []) elts = let a = match src with | None -> a | Some uri -> (a_src uri) :: a in match srcs with | None -> Xml.node name ~a elts | Some srcs -> Xml.node name ~a (W.append srcs elts) let audio = video_audio "audio" let video = video_audio "video" let canvas = star "canvas" let command ~label ?(a = []) () = Xml.leaf ~a: ((a_label label) :: a) "command" let ?children ?a () = let children = match children with | None -> W.nil () | Some (`Lis l) | Some (`Flows l) -> l in Xml.node ?a "menu" children let embed = terminal "embed" let source = terminal "source" let meter = star "meter" let output_elt = star "output" let form = star "form" let svg ?(a = []) children = Svg.toelt (Svg.svg ~a children) let input = terminal "input" let keygen = terminal "keygen" let label = star "label" let option = unary "option" let select = star "select" let textarea = unary "textarea" let = star "button" let datalist ?children ?a () = let children = match children with | None -> W.nil () | Some (`Options x | `Phras x) -> x in Xml.node ?a "datalist" children let progress = star "progress" let legend = star "legend" let details summary ?a children = plus "details" ?a summary children let summary = star "summary" let fieldset ?legend ?a elts = Xml.node ?a "fieldset" (option_cons legend elts) let optgroup ~label ?(a = []) elts = Xml.node ~a: ((a_label label) :: a) "optgroup" elts let figcaption = star "figcaption" let figure ?figcaption ?a elts = let content = match figcaption with | None -> elts | Some (`Top c) -> W.cons c elts | Some (`Bottom c) -> W.append elts (W.singleton c) in Xml.node ?a "figure" content let caption = star "caption" let tablex ?caption ?columns ?thead ?tfoot ?a elts = let content = option_cons thead (option_cons tfoot elts) in let content = match columns with | None -> content | Some columns -> W.append columns content in let content = option_cons caption content in Xml.node ?a "table" content let table = tablex let td = star "td" let th = star "th" let tr = star "tr" let colgroup = star "colgroup" let col = terminal "col" let thead = star "thead" let tbody = star "tbody" let tfoot = star "tfoot" let iframe = star "iframe" let object_ ?params ?(a = []) elts = let elts = match params with | None -> elts | Some e -> W.append e elts in Xml.node ~a "object" elts let param = terminal "param" let img ~src ~alt ?(a = []) () = let a = (a_src src) :: (a_alt alt) :: a in Xml.leaf ~a "img" let picture ~img ?a elts = let tail_node = W.cons img (W.nil ()) in let content = W.append elts tail_node in Xml.node ?a "picture" content let meta = terminal "meta" let style ?(a = []) elts = Xml.node ~a "style" elts let link ~rel ~href ?(a = []) () = Xml.leaf ~a: ((a_rel rel) :: (a_href href) :: a) "link" let base = terminal "base" (******************************************************************) (* Conversion from and to Xml module *) let tot x = x let totl x = x let toelt x = x let toeltl x = x type doc = [ `Html ] elt let doc_toelt x = x module I = Xml_stream.Import(Xml) let of_seq s = totl @@ I.of_seq s module Unsafe = struct let data s = Xml.encodedpcdata s let leaf tag ?a () = Xml.leaf ?a tag let node tag ?a elts = Xml.node ?a tag elts let coerce_elt x = x let float_attrib = Xml.float_attrib let int_attrib = Xml.int_attrib let string_attrib = Xml.string_attrib let uri_attrib a s = Xml.uri_attrib a s let space_sep_attrib = Xml.space_sep_attrib let comma_sep_attrib = Xml.comma_sep_attrib end end module Wrapped_functions (Xml : Xml_sigs.T with type ('a,'b) W.ft = 'a -> 'b) = struct module Xml = Xml let string_of_sandbox_token = function | `Allow_forms -> "allow-forms" | `Allow_pointer_lock -> "allow-pointer-lock" | `Allow_popups -> "allow-popups" | `Allow_top_navigation -> "allow-top-navigation" | `Allow_same_origin -> "allow-same-origin" | `Allow_script -> "allow-script" let string_of_linktype = function | `Alternate -> "alternate" | `Archives -> "archives" | `Author -> "author" | `Bookmark -> "bookmark" | `Canonical -> "canonical" | `Dns_prefetch -> "dns-prefetch" | `External -> "external" | `First -> "first" | `Help -> "help" | `Icon -> "icon" | `Index -> "index" | `Last -> "last" | `License -> "license" | `Manifest -> "manifest" | `Me -> "me" | `Modulepreload -> "modulepreload" | `Next -> "next" | `Nofollow -> "nofollow" | `Noopener -> "noopener" | `Noreferrer -> "noreferrer" | `Opener -> "opener" | `Pingback -> "pingback" | `Preconnect -> "preconnect" | `Prefetch -> "prefetch" | `Preload -> "preload" | `Prerender -> "prerender" | `Prev -> "prev" | `Search -> "search" | `Stylesheet -> "stylesheet" | `Sidebar -> "sidebar" | `Tag -> "tag" | `Up -> "up" | `Other s -> s let string_of_mediadesc_token = function | `All -> "all" | `Aural -> "aural" | `Braille -> "braille" | `Embossed -> "embossed" | `Handheld -> "handheld" | `Print -> "print" | `Projection -> "projection" | `Screen -> "screen" | `Speech -> "speech" | `Tty -> "tty" | `Tv -> "tv" | `Raw_mediadesc s -> s let string_of_referrerpolicy = function | `Empty -> "" | `No_referrer -> "no-referrer" | `No_referrer_when_downgrade -> "no-referrer-when-downgrade" | `Origin -> "origin" | `Origin_when_cross_origin -> "origin-when-cross-origin" | `Same_origin -> "same-origin" | `Strict_origin -> "strict-origin" | `Strict_origin_when_cross_origin -> "strict-origin-when-cross-origin" | `Unsafe_url -> "unsafe-url" let string_of_big_variant = function | `Anonymous -> "anonymous" | `Async -> "async" | `Autofocus -> "autofocus" | `Autoplay -> "autoplay" | `Checked -> "checked" | `Defer -> "defer" | `Disabled -> "disabled" | `Muted -> "muted" | `ReadOnly -> "readonly" | `Rect -> "rect" | `Selected -> "selected" | `Use_credentials -> "use-credentials" | `W3_org_1999_xhtml -> "http://www.w3.org/1999/xhtml" | `All -> "all" | `Preserve -> "preserve" | `Default -> "default" | `Controls -> "controls" | `Ltr -> "ltr" | `Rtl -> "rtl" | `Get -> "GET" | `Post -> "POST" | `Formnovalidate -> "formnovalidate" | `Hidden -> "hidden" | `Ismap -> "ismap" | `Loop -> "loop" | `Novalidate -> "novalidate" | `Open -> "open" | `None -> "none" | `Metadata -> "metadata" | `Audio -> "audio" | `Pubdate -> "pubdate" | `Required -> "required" | `Reversed -> "reserved" | `Scoped -> "scoped" | `Seamless -> "seamless" | `Any -> "any" | `Soft -> "soft" | `Hard -> "hard" | `Context -> "context" | `Toolbar -> "toolbar" | `Command -> "command" | `Checkbox -> "checkbox" | `Radio -> "radio" | `Multiple -> "multiple" | `Left -> "left" | `Right -> "right" | `Justify -> "justify" | `Char -> "char" | `Row -> "row" | `Col -> "col" | `Rowgroup -> "rowgroup" | `Colgroup -> "colgroup" | `Groups -> "groups" | `Rows -> "rows" | `Cols -> "cols" | `Zero -> "0" | `One -> "1" | `Yes -> "yes" | `No -> "no" | `Auto -> "auto" | `Circle -> "circle" | `Poly -> "poly" | `Alternate -> "alternate" | `Archives -> "archives" | `Author -> "author" | `Bookmark -> "bookmark" | `External -> "external" | `First -> "first" | `Help -> "help" | `Icon -> "icon" | `Index -> "index" | `Last -> "last" | `License -> "license" | `Next -> "next" | `Nofollow -> "nofollow" | `Noreferrer -> "noreferrer" | `Pingback -> "pingback" | `Prefetch -> "prefetch" | `Prev -> "prev" | `Search -> "search" | `Stylesheet -> "stylesheet" | `Sidebar -> "sidebar" | `Tag -> "tag" | `Up -> "up" | `Verbatim -> "verbatim" | `Latin -> "latin" | `Latin_name -> "latin-name" | `Latin_prose -> "latin-prose" | `Full_width_latin -> "full-width-latin" | `Kana -> "kana" | `Katakana -> "katakana" | `Numeric -> "numeric" | `Tel -> "tel" | `Email -> "email" | `Url -> "url" | `Text -> "text" | `Decimal -> "decimal" | `Other s -> s let string_of_input_type = function | `Button -> "button" | `Checkbox -> "checkbox" | `Color -> "color" | `Date -> "date" | `Datetime -> "datetime" | `Datetime_local -> "datetime-local" | `Email -> "email" | `File -> "file" | `Hidden -> "hidden" | `Image -> "image" | `Month -> "month" | `Number -> "number" | `Password -> "password" | `Radio -> "radio" | `Range -> "range" | `Readonly -> "readonly" | `Reset -> "reset" | `Search -> "search" | `Submit -> "submit" | `Tel -> "tel" | `Text -> "text" | `Time -> "time" | `Url -> "url" | `Week -> "week" let string_of_script_type = function | `Javascript -> "application/javascript" | `Module -> "module" | `Mime s -> s let string_of_number_or_datetime = function | `Number n -> string_of_int n | `Datetime t -> t let string_of_character = String.make 1 let string_of_number = string_of_int let string_of_bool = string_of_bool let onoff_of_bool = function | false -> "off" | true -> "on" let unoption_string = function | Some x -> x | None -> "" let string_of_step = function | Some x -> Xml_print.string_of_number x | None -> "any" let string_of_sizes = function | Some l -> String.concat " " (List.map (fun (x, y) -> Printf.sprintf "%dx%d" x y) l) | None -> "any" let string_of_sandbox l = String.concat " " (List.map string_of_sandbox_token l) let string_of_numbers l = String.concat "," (List.map string_of_number l) let string_of_mediadesc l = String.concat ", " (List.map string_of_mediadesc_token l) let string_of_linktypes l = String.concat " " (List.map string_of_linktype l) type image_candidate = [ `Url of Xml.uri | `Url_width of Xml.uri * Html_types.number | `Url_pixel of Xml.uri * Html_types.float_number ] let string_of_srcset (l : [< image_candidate] list) = let f = function | `Url url -> Xml.string_of_uri url | `Url_width (url, v) -> Printf.sprintf "%s %sw" (Xml.string_of_uri url) (string_of_number v) | `Url_pixel (url, v) -> Printf.sprintf "%s %sx" (Xml.string_of_uri url) (Xml_print.string_of_number v) in String.concat ", " (List.map f l) let string_of_autocomplete (l : Html_types.autocomplete_option) = match l with | `On | `Tokens [] -> "on" | `Off -> "off" | `Tokens strs -> String.concat " " strs end module Make (Xml : Xml_sigs.T with type ('a, 'b) W.ft = 'a -> 'b) (Svg : Svg_sigs.T with module Xml := Xml) = Make_with_wrapped_functions(Xml)(Wrapped_functions(Xml))(Svg)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>