package mrmime
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Mr. MIME
Install
dune-project
Dependency
Authors
Maintainers
Sources
mrmime-v0.5.0.tbz
sha256=0ac119fbcf49e66d2e13dec3cc23109be03cbd7b9f7f868ab1afb3eb3bf2c4e4
sha512=3f047fea13792415317ca5e3ba26a5ca8761662de57937a3b40ae590a0d5a82da645118472fc25ff8568b6615587264ae0c410adf39ae0498492e9a0dfa6695e
doc/src/mrmime/unstructured.ml.html
Source file unstructured.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 70type box = Box | TBox of int | BBox type elt = [ Unstrctrd.elt | `Open of box | `Close ] type t = elt list let pp ppf t = let t = List.fold_left (fun a -> function #Unstrctrd.elt as x -> x :: a | _ -> a) [] t |> List.rev in match Unstrctrd.of_list t with | Ok l -> let s = Unstrctrd.to_utf_8_string l in Fmt.pf ppf "<unstrctrd:%s>" s | Error _ -> Fmt.pf ppf "<invalid-unstrctrd>" module Decoder = struct let unstructured () = let buf = Bytes.create 0x7f in Unstrctrd_parser.unstrctrd buf end module Craft = struct let sp len : elt list = [ (Unstrctrd.wsp ~len :> elt) ] let v s = List.init (String.length s) (fun i -> `Uchar (Uchar.of_char s.[i])) let compile : elt list list -> t = List.concat let concat : t -> t -> t = fun a b -> a @ b let ( @ ) = concat end module Encoder = struct open Prettym type uchar = [ `Uchar of Uchar.t ] type ok_or_partial = [ `Ok | `Partial ] let element : elt t = fun ppf -> function | `CR -> string ppf "\r" | `LF -> string ppf "\n" | `Open Box -> eval ppf [ box ] | `Open (TBox n) -> eval ppf [ tbox n ] | `Open BBox -> eval ppf [ bbox ] | `Close -> eval ppf [ close ] | `FWS wsp -> let ppf = eval ppf [ cut; new_line ] in string ppf (wsp :> string) | `OBS_NO_WS_CTL chr -> char ppf (chr :> char) | `WSP wsp -> eval ppf [ spaces (String.length (wsp :> string)) ] | `d0 -> char ppf '\000' | `Invalid_char _ -> string ppf "\xEF\xBF\xBD" | #uchar as uchar -> let output = Stdlib.Buffer.create 4 in let encoder = Uutf.encoder `UTF_8 (`Buffer output) in (* XXX(dinosaure): [Uutf.encoder_dst <> `Manual]. It's safe. *) let[@warning "-8"] (`Ok : ok_or_partial) = Uutf.encode encoder uchar in let[@warning "-8"] (`Ok : ok_or_partial) = Uutf.encode encoder `End in string ppf (Stdlib.Buffer.contents output) let noop = ((fun ppf () -> ppf), ()) let unstructured : elt list t = fun ppf lst -> list ~sep:noop element ppf lst end let of_string x = match Unstrctrd.of_string x with | Ok (_consumed, v) -> Ok v | Error (`Msg err) -> Error (`Msg err) let to_string x = Prettym.to_string Encoder.unstructured x
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>