aboutsummaryrefslogtreecommitdiff
path: root/lib/xml.ml
diff options
context:
space:
mode:
authorMarc Coquand <marcc@fastmail.fr>2023-12-02 09:49:42 -0600
committerMarc Coquand <marcc@fastmail.fr>2023-12-02 09:49:42 -0600
commit69d3f53365568524e18dfb1200a386309e174359 (patch)
tree30e465d36ea03bceb1f4e9b54aadfdb6d7093162 /lib/xml.ml
downloadwormhole-69d3f53365568524e18dfb1200a386309e174359.tar.gz
wormhole-69d3f53365568524e18dfb1200a386309e174359.tar.bz2
wormhole-69d3f53365568524e18dfb1200a386309e174359.zip
Initial commit
Diffstat (limited to 'lib/xml.ml')
-rw-r--r--lib/xml.ml10
1 files changed, 10 insertions, 0 deletions
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 "@[<hv 3><%s>@,%a@;<0 -3></%s>@]" name format_body body name
+ | String text -> format f "%s" text