Gitlab is now running v13.9.0 - More info -> here <-

Commit 34c1af61 authored by Philippe Veber's avatar Philippe Veber

tk/Note: enable dataframe rendering customization

parent fd4cf9de
......@@ -2,7 +2,7 @@ open Core_kernel
type elt =
| Text of string
| Dataframe of Dataframe.t
| Dataframe of Dataframe.t * (string * Dataframe.html_formatter) list
| Png of string
| Svg of string
| Vg of Vg.image
......@@ -18,7 +18,7 @@ let make ?(toc = false) ~title contents = {
}
let text x = Text x
let dataframe d = Dataframe d
let dataframe ?(formatters = []) d = Dataframe (d, formatters)
let png fn = Png fn
let svg fn = Svg fn
let vg i = Vg i
......@@ -34,9 +34,9 @@ let render_picture format data buf =
let render_picture_on_disk format fn buf =
render_picture format (In_channel.read_all fn) buf
let render_dataframe data buf =
let render_dataframe formatters data buf =
let fmt = Format.formatter_of_buffer buf in
Tyxml.Html.pp_elt () fmt (Dataframe.to_html data) ;
Tyxml.Html.pp_elt () fmt (Dataframe.to_html ~formatters data) ;
Format.pp_print_flush fmt ()
let header doc =
......@@ -54,7 +54,7 @@ let render_doc doc =
| Text t -> Buffer.add_string buf t
| Png fn -> render_picture_on_disk `png fn buf
| Svg fn -> render_picture_on_disk `svg fn buf
| Dataframe data -> render_dataframe data buf
| Dataframe (data, formatters) -> render_dataframe formatters data buf
| Vg _ -> assert false
) ;
Buffer.add_string buf "\n\n"
......
......@@ -4,7 +4,10 @@ type elt
val text : string -> elt
val dataframe : Dataframe.t -> elt
val dataframe :
?formatters:(string * Dataframe.html_formatter) list ->
Dataframe.t ->
elt
val png : string -> elt
val svg : string -> elt
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment