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/xml_stream.ml.html
Source file xml_stream.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
(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2018 Gabriel Radanne * * 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. *) type name = string * string (** Input *) type signal = [ | `Comment of string | `End_element | `Start_element of name * (name * string) list | `Text of string list ] exception Malformed_stream module Import (Xml : Xml_sigs.T) = struct let of_list l = List.fold_right (fun a b -> Xml.W.(cons (return a) b)) l (Xml.W.nil ()) let mk_attribs attrs = (* TODO: This is not very structured *) let f ((_,name), v) = Xml.string_attrib name (Xml.W.return v) in List.map f attrs let rec mk children (seq : signal Seq.t) = match seq () with | Cons (`Comment s, q) -> mk (Xml.comment s :: children) q | Cons (`Text s, q) -> mk (List.map (fun x -> Xml.pcdata @@ Xml.W.return x) s @ children) q | Cons (`Start_element ((_, name), attrs), q) -> let a = mk_attribs attrs in let sub_children, rest = mk [] q in mk (Xml.node ~a name sub_children :: children) rest | Cons (`End_element, rest) -> of_list (List.rev children), rest | Nil -> of_list (List.rev children), Seq.empty let of_seq seq = let l, rest = mk [] seq in match rest () with | Seq.Nil -> l | _ -> raise Malformed_stream end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>