ocaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix TeX_like module cycle

References: https://todo.sr.ht/~jonsterling/forester/165

+27 -38
+2 -2
lib/compiler/Eval.ml
··· 300 300 process_tape () 301 301 | Embed_tex -> 302 302 let config = Config_env.read () in 303 - let preamble = pop_content_arg ~loc |> T.TeX_like.string_of_content in 304 - let body = pop_content_arg ~loc |> T.TeX_like.string_of_content in 303 + let preamble = pop_content_arg ~loc |> TeX_like.string_of_content in 304 + let body = pop_content_arg ~loc |> TeX_like.string_of_content in 305 305 let source = LaTeX_template.to_string ~preamble ~body in 306 306 let hash = Digest.to_hex @@ Digest.string source in 307 307 let job = Job.{hash; source} in
+1
lib/core/Forester_core.ml
··· 54 54 module TeX_cs = TeX_cs 55 55 56 56 module Types = Types 57 + module TeX_like = TeX_like (* TODO: rename this *) 57 58 58 59 module Trie = Trie 59 60
+15
lib/core/TeX_like.ml
··· 1 + open Types 2 + 3 + let rec pp_content fmt = function 4 + | (Content nodes) -> 5 + (List.iter @@ pp_content_node fmt) nodes 6 + 7 + and pp_content_node fmt = function 8 + | Text str -> Format.fprintf fmt "%s" str 9 + | CDATA str -> Format.fprintf fmt "%s" str 10 + | KaTeX (_, xs) -> pp_content fmt xs 11 + | Xml_elt _ | Transclude _ | Contextual_number _ | Section _ | Link _ | Artefact _ | Uri _ | Route_of_uri _ | Datalog_script _ | Results_of_datalog_query _ -> 12 + Reporter.fatal Internal_error ~extra_remarks: [Asai.Diagnostic.loctextf "Cannot render this kind of content node as TeX-like string"] 13 + 14 + let string_of_content = 15 + Format.asprintf "%a" pp_content
+4
lib/core/TeX_like.mli
··· 1 + open Types 2 + 3 + val pp_content : Format.formatter -> content -> unit 4 + val string_of_content : content -> string
+4 -35
lib/core/Types.ml
··· 159 159 | Results_of_datalog_query of (string, 'content vertex) Datalog_expr.query 160 160 [@@deriving show, repr] 161 161 162 - type content = Content of content content_node list 162 + type content = 163 + Content of content content_node list 163 164 [@@deriving show, repr] 164 165 165 - 166 - let rec compress_nodes = 167 - function 166 + let rec compress_nodes = function 168 167 | [] -> [] 169 168 | Text x :: Text y :: ys -> compress_nodes (Text (x ^ y) :: ys) 170 169 | x :: xs -> x :: compress_nodes xs 171 170 172 - let compress_content = 173 - function 171 + let compress_content = function 174 172 | Content nodes -> Content (compress_nodes nodes) 175 173 176 174 let concat_compressed_content (Content xs) (Content ys) = ··· 264 262 265 263 let compare_article = compare_frontmatter |> Compare.under @@ fun x -> x.frontmatter 266 264 end 267 - 268 - module TeX_like : sig 269 - val pp_content : Format.formatter -> content -> unit 270 - val string_of_content : content -> string 271 - end 272 - = struct 273 - let rec pp_content fmt = function 274 - | (Content nodes) -> 275 - (List.iter @@ pp_content_node fmt) nodes 276 - 277 - and pp_content_node fmt = function 278 - | Text str -> Format.fprintf fmt "%s" str 279 - | CDATA str -> Format.fprintf fmt "%s" str 280 - | KaTeX (_, xs) -> pp_content fmt xs 281 - | Xml_elt _ | Transclude _ | Contextual_number _ | Section _ | Link _ | Artefact _ | Uri _ | Route_of_uri _ | Datalog_script _ | Results_of_datalog_query _ -> 282 - (*Temporary workaround, this causes a dependency cycle 283 - Vertex_set 284 - -> Reporter 285 - -> Reporter 286 - -> required by _build/default/lib/core/Forester_core.a 287 - -> required by alias lib/core/all 288 - -> required by alias default 289 - *) 290 - (* Reporter.fatal (Internal_error "Cannot render this kind of content as TeX-like string") *) 291 - assert false 292 - 293 - let string_of_content = 294 - Format.asprintf "%a" pp_content 295 - end
+1 -1
lib/frontend/Legacy_xml_client.ml
··· 202 202 | Inline -> "inline" 203 203 | Display -> "block" 204 204 in 205 - let body = Format.asprintf "%a" T.TeX_like.pp_content content in 205 + let body = Format.asprintf "%a" TeX_like.pp_content content in 206 206 [X.tex [X.display "%s" display] "<![CDATA[%s]]>" body] 207 207 | Artefact resource -> 208 208 [render_artefact forest resource]