aboutsummaryrefslogtreecommitdiffhomepage
path: root/library/lib.ml
diff options
context:
space:
mode:
authorGravatar Maxime Dénès <mail@maximedenes.fr>2016-01-15 17:49:49 +0100
committerGravatar Maxime Dénès <mail@maximedenes.fr>2016-01-15 17:49:49 +0100
commit74a5cfa8b2f1a881ebf010160421cf0775c2a084 (patch)
tree60444d73bc9f0824920b34d60b60b6721a603e92 /library/lib.ml
parent088977e086a5fd72f5f724192e5cb5ba1a0d9bb6 (diff)
Hooks for a third-party XML plugin. Contributed by Claudio Sacerdoti Coen.
Diffstat (limited to 'library/lib.ml')
-rw-r--r--library/lib.ml6
1 files changed, 6 insertions, 0 deletions
diff --git a/library/lib.ml b/library/lib.ml
index 297441e6e..42cea4de8 100644
--- a/library/lib.ml
+++ b/library/lib.ml
@@ -497,6 +497,10 @@ let full_section_segment_of_constant con =
(*************)
(* Sections. *)
+(* XML output hooks *)
+let (f_xml_open_section, xml_open_section) = Hook.make ~default:ignore ()
+let (f_xml_close_section, xml_close_section) = Hook.make ~default:ignore ()
+
let open_section id =
let olddir,(mp,oldsec) = !path_prefix in
let dir = add_dirpath_suffix olddir id in
@@ -508,6 +512,7 @@ let open_section id =
(*Pushed for the lifetime of the section: removed by unfrozing the summary*)
Nametab.push_dir (Nametab.Until 1) dir (DirOpenSection prefix);
path_prefix := prefix;
+ if !Flags.xml_export then Hook.get f_xml_open_section id;
add_section ()
@@ -536,6 +541,7 @@ let close_section () =
let full_olddir = fst !path_prefix in
pop_path_prefix ();
add_entry oname (ClosedSection (List.rev (mark::secdecls)));
+ if !Flags.xml_export then Hook.get f_xml_close_section (basename (fst oname));
let newdecls = List.map discharge_item secdecls in
Summary.unfreeze_summaries fs;
List.iter (Option.iter (fun (id,o) -> add_discharged_leaf id o)) newdecls;