package dose3
Dose library (part of Mancoosi tools)
Install
Dune Dependency
Authors
Maintainers
Sources
dose3-6.1.tar.gz
md5=dedc2f58f2c2b59021f484abc6681d93
sha512=603462645bac190892a816ecb36ef7b9c52f0020f8d7710dc430e2db65122090fdedb24a8d2e03c32bf53a96515f5b51499603b839680d0a7a2146d6e0fb6e34
doc/src/dose3.common/url.ml.html
Source file url.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
(****************************************************************************) (* Copyright (C) 2011,2012,2013 Ralf Treinen *) (* <ralf.treinen@pps.univ-paris-diderot.fr> *) (* *) (* This library 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, either version 3 of the *) (* License, or (at your option) any later version. A special linking *) (* exception to the GNU Lesser General Public License applies to this *) (* library, see the COPYING file for more information. *) (****************************************************************************) exception Invalid_url of string include Util.Logging (struct let label = "dose_common.url" end) (***********************************************************************) (* Input schemes *******************************************************) type debtypes = [ `Edsp | `Deb | `DebSrc ] type rpmtypes = [ `Synthesis | `Hdlist ] type othertypes = [ `Csw | `Pef | `Opam | `Npm ] type filetypes = [ `Cudf | debtypes | rpmtypes | othertypes ] let supported_input_types = [`Edsp; `Deb; `DebSrc; `Synthesis; `Hdlist; `Pef; `Opam; `Csw; `Cudf; `Npm] let scheme_to_string = function | `Edsp -> "edsp" | `Csw -> "csw" | `Deb -> "deb" | `DebSrc -> "debsrc" | `Pef -> "pef" | `Opam -> "opam" | `Npm -> "npm" | `Cudf -> "cudf" | `Synthesis -> "synthesis" | `Hdlist -> "hdlist" let scheme_of_string = function | "edsp" -> `Edsp | "csw" -> `Csw | "deb" -> `Deb | "opam" -> `Opam | "npm" -> `Npm | "debsrc" -> `DebSrc | "cudf" -> `Cudf | "eclipse" | "pef" -> `Pef | "synthesis" -> `Synthesis | "hdlist" -> `Hdlist | s -> let supported = String.concat ", " (List.map scheme_to_string supported_input_types) in fatal "unknown input scheme: \"%s\" - Must be one of: %s" s supported (***********************************************************************) (* URLs ****************************************************************) type url = { scheme : filetypes; path : string (* filename *) } let to_string u = scheme_to_string u.scheme ^ "://" ^ u.path let of_string s = let l = String.length s in let pos_colon = try String.index s ':' with Not_found -> fatal "missing '://' separator %s" s in if pos_colon + 2 >= l || s.[pos_colon + 1] <> '/' || s.[pos_colon + 2] <> '/' then fatal "missing '://' separator %s" s ; let scheme = scheme_of_string (String.sub s 0 pos_colon) and start_rest = pos_colon + 3 in { scheme; path = String.sub s start_rest (l - start_rest) }
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>