From 69d3f53365568524e18dfb1200a386309e174359 Mon Sep 17 00:00:00 2001 From: Marc Coquand Date: Sat, 2 Dec 2023 09:49:42 -0600 Subject: Initial commit --- lib/xml.ml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 lib/xml.ml (limited to 'lib/xml.ml') diff --git a/lib/xml.ml b/lib/xml.ml new file mode 100644 index 0000000..fe4abdc --- /dev/null +++ b/lib/xml.ml @@ -0,0 +1,10 @@ +type xml = Tag of string * xml list | String of string + +let tag name body = Tag (name, body) +let format, format_list = Format.(fprintf, pp_print_list) + +let rec format_xml f = function + | Tag (name, body) -> + let format_body = format_list format_xml in + format f "@[<%s>@,%a@;<0 -3>@]" name format_body body name + | String text -> format f "%s" text -- cgit v1.2.3