Module Djot.Mapper

type 'a filter_map = 'a option
type 'a result = [
  1. | `Default
  2. | `Map of 'a
]
val default : 'a result

Keep the node and map its children.

val delete : 'a filter_map result
val ret : 'a -> 'a filter_map result
type t
type 'a mapper = t -> 'a -> 'a filter_map result
val make : ?inline:Inline.t node mapper -> ?block:Block.t node mapper -> unit -> t
val map_inline : t -> Inline.t node -> Inline.t node filter_map
val map_block : t -> Block.t node -> Block.t node filter_map

A Block.t.Ext_keyed whose block is deleted is deleted.

val map_doc : t -> Doc.t -> Doc.t

The document made of the mapped blocks, as Doc.make gives it, with the profile and the positions of the one given. The mapper sees Doc.blocks without the identifiers in Doc.auto_identifiers; they are derived again from the result, and so are the sections, Doc.footnotes, Doc.references and Doc.auto_references.

The result is not tied to any text: an edit of the Source the document came from gives the parse of the edited text, without the map.

val holes_as_raw : t

Each Inline.t.Hole e as RawInline ("hole", e), which is also what `e`{=hole} reads as. A consumer that evaluates holes then has one shape inline, a raw inline in format hole, as it has one for blocks, a raw block in that format.