package forester
A tool for tending mathematical forests
Install
Dune Dependency
Authors
Maintainers
Sources
5.0.tar.gz
md5=24f4aed96a8b8af33aba13fba66f1b37
sha512=d36b896aca11858bb4a00fc704c16cc27a1f197bdb3e479d6132fd70f70d67d7158096285cb0b6fb00db14417f0f822cc27fe65d82f0971e42378fd8271ce573
doc/src/forester.core/Syn.ml.html
Source file Syn.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
(* * SPDX-FileCopyrightText: 2024 The Forester Project Contributors * * SPDX-License-Identifier: GPL-3.0-or-later *) open Base open Forester_xml_names type node = | Text of string | Verbatim of string | Group of delim * t | Math of math_mode * t | Link of {dest: t; title: t option} | Subtree of string option * t | Fun of string binding list * t | Var of string | Sym of Symbol.t | Put of t * t * t | Default of t * t * t | Get of t | Xml_tag of xml_qname * (xml_qname * t) list * t | TeX_cs of TeX_cs.t | Unresolved_ident of ((resolver_data, Range.t option) Trie.t [@opaque]) * Trie.path | Prim of Prim.t | Object of {self: string option; methods: (string * t) list} | Patch of {obj: t; self: string option; super: string option; methods: (string * t) list} | Call of t * string | Results_of_query | Transclude | Embed_tex | Ref | Title | Parent | Taxon | Meta | Attribution of Types.attribution_role * [`Content | `Uri] | Tag of [`Content | `Uri] | Date | Number | Dx_sequent of t * t list | Dx_query of string * t list * t list | Dx_prop of t * t list | Dx_var of string | Dx_const of [`Content | `Uri] * t | Dx_execute | Route_asset | Syndicate_query_as_json_blob | Syndicate_current_tree_as_atom_feed | Current_tree [@@deriving show] and t = node Range.located list [@@deriving show] and resolver_data = | Term of t | Xmlns of {xmlns: string; prefix: string} [@@deriving show] let map f node = match node with | Group (d, t) -> Group (d, f @@ t) | Math (m, t) -> Math (m, f @@ t) | Subtree (a, t) -> Subtree (a, f @@ t) | Link {dest; title} -> Link {dest = f @@ dest; title = Option.map f title} | Fun (b, t) -> Fun (b, f t) | Put (r, s, t) -> Put (f r, f s, f t) | Default (r, s, t) -> Default (f r, f s, f t) | Get t -> Get (f t) | Xml_tag (q, qs, t) -> Xml_tag (q, List.map (fun (q, t) -> q, f t) qs, f t) | Call (t, s) -> Call (f t, s) | Object {self; methods} -> Object {self; methods = List.map (fun (str, t) -> str, f t) methods} | Patch {obj; self; super; methods} -> Patch {obj = f obj; self; super; methods = List.map (fun (str, t) -> str, f t) methods} | Dx_sequent (t, ts) -> Dx_sequent (f t, List.map f ts) | Dx_query (s, ps, ns) -> Dx_query (s, List.map f ps, List.map f ns) | Dx_const (s, n) -> Dx_const (s, f n) | Dx_prop (t, ts) -> Dx_prop (f t, List.map f ts) | Text _ | Verbatim _ | Var _ | Sym _ | TeX_cs _ | Unresolved_ident _ | Prim _ | Results_of_query | Transclude | Embed_tex | Ref | Title | Parent | Taxon | Meta | Attribution (_, _) | Tag _ | Date | Number | Dx_var _ | Dx_execute | Route_asset | Syndicate_current_tree_as_atom_feed | Syndicate_query_as_json_blob | Current_tree -> node let children (node : node Range.located) = match node.value with | Group (_, t) -> t | Math (_, t) -> t | Subtree (_, t) -> t | Link {dest; title} -> Option.fold ~some: (fun t -> t @ dest) ~none: dest title | Fun (_, t) -> t | Put (r, s, t) -> r @ s @ t | Default (r, s, t) -> r @ s @ t | Get t -> t | Xml_tag (_, qs, t) -> List.concat_map snd qs @ t | Call (t, _) -> t | Object {methods; _} -> List.concat_map snd methods | Patch {obj; methods; _} -> List.concat_map snd methods @ obj | Dx_sequent (t, ts) -> t @ List.concat ts | Dx_query (_, ps, ns) -> List.concat ps @ List.concat ns | Dx_const (_, n) -> n | Dx_prop (t, ts) -> t @ List.concat ts | Text _ | Verbatim _ | Var _ | Sym _ | TeX_cs _ | Unresolved_ident _ | Prim _ | Results_of_query | Transclude | Embed_tex | Ref | Title | Parent | Taxon | Meta | Attribution (_, _) | Tag _ | Date | Number | Dx_var _ | Dx_execute | Route_asset | Syndicate_current_tree_as_atom_feed | Syndicate_query_as_json_blob | Current_tree -> []
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>