Skip to content

Commit

Permalink
Merge pull request #5 from tbrugere/clean
Browse files Browse the repository at this point in the history
added set_meta function
  • Loading branch information
smimram authored Oct 9, 2024
2 parents faad81a + 95109c6 commit bacdb52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pandoc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,10 @@ let meta_string p k =
| MetaString s -> s
| _ -> raise Not_found

let set_meta v p k =
let meta = List.remove_assoc k (meta p) in
{ p with meta = (k, v) :: meta }

(** {2 Transforming} *)

(** Change the list of blocks. *)
Expand Down
3 changes: 3 additions & 0 deletions src/pandoc.mli
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ val meta_bool : t -> string -> bool
(** Value of a string metadata. *)
val meta_string : t -> string -> string

(** Add a metadata value *)
val set_meta : t -> string -> meta_value -> t

(** {2 Mapping functions} *)

(** General mapping function which maps a function on blocks and a function on
Expand Down

0 comments on commit bacdb52

Please sign in to comment.