Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Gitlab is now running v13.9.0 - More info ->
here
<-
Open sidebar
VEBER Philippe
codepi
Commits
a4f8dddc
Commit
a4f8dddc
authored
Dec 16, 2020
by
Philippe Veber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tk/Note: support for dataframe
parent
39f20f75
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
lib/tk/note.ml
lib/tk/note.ml
+8
-3
lib/tk/note.mli
lib/tk/note.mli
+1
-1
No files found.
lib/tk/note.ml
View file @
a4f8dddc
...
...
@@ -2,7 +2,7 @@ open Core_kernel
type
elt
=
|
Text
of
string
|
Table
of
(
string
*
string
list
)
lis
t
|
Dataframe
of
Dataframe
.
t
|
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
table
cols
=
Table
cols
let
dataframe
d
=
Dataframe
d
let
png
fn
=
Png
fn
let
svg
fn
=
Svg
fn
let
vg
i
=
Vg
i
...
...
@@ -34,6 +34,10 @@ 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
fmt
=
Format
.
formatter_of_buffer
buf
in
Tyxml
.
Html
.
pp_elt
()
fmt
(
Dataframe
.
to_html
data
)
;
Format
.
pp_print_flush
fmt
()
let
header
doc
=
sprintf
{
|---
...
...
@@ -50,7 +54,8 @@ 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
|
_
->
failwith
"not implemented"
|
Dataframe
data
->
render_dataframe
data
buf
|
Vg
_
->
assert
false
)
;
Buffer
.
add_string
buf
"
\n\n
"
)
;
...
...
lib/tk/note.mli
View file @
a4f8dddc
...
...
@@ -4,7 +4,7 @@ type elt
val
text
:
string
->
elt
val
table
:
(
string
*
string
list
)
lis
t
->
elt
val
dataframe
:
Dataframe
.
t
->
elt
val
png
:
string
->
elt
val
svg
:
string
->
elt
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment