package forester
A tool for tending mathematical forests
Install
Dune Dependency
Authors
Maintainers
Sources
4.2.0.tar.gz
md5=7543fe7acbdfeb2056dc0b774965239f
sha512=2317bf84588692bbbd40e5fa944faab4889474e4a058e336bd1165f6dd8e55e8979affab098248c87354acdc3b6e6927305553ff5ab6b002b6739719814ec080
doc/src/forester.render/Render_text.ml.html
Source file Render_text.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
open Forester_prelude open Forester_core module Printer = struct module P0 = struct type out = Format.formatter let text txt fmt = Format.fprintf fmt "%s" txt end include Printer_kit.Kit (P0) let contents (printer : t) : string = Format.asprintf "%a" (fun fmt _ -> printer fmt) () end let rec render_node ~trees : Sem.node Range.located -> Printer.t = fun node -> match node.value with | Sem.Text txt | Sem.Verbatim txt -> Printer.text txt | Sem.Math (_, xs) -> render ~trees xs | Sem.Xml_tag (name, _, body) -> render ~trees body | Sem.Link (addr, None, modifier) -> render ~trees @@ Option.value ~default:[Range.locate_opt None @@ Sem.Text "Untitled"] @@ Option.bind (Addr_map.find_opt addr trees) @@ fun (tree : Sem.tree) -> Option.map (Sem.apply_modifier modifier) tree.fm.title | Sem.Link (addr, Some title, modifier) -> render ~trees @@ Sem.apply_modifier modifier title | Sem.Prim (_, x) -> render ~trees x | Sem.TeX_cs _ -> Printer.nil | _ -> Reporter.fatal ?loc:node.loc Unhandled_case "unhandled case in plain text renderer" and render ~trees xs = Printer.iter (render_node ~trees) xs
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>