-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtest_md.ml
113 lines (106 loc) · 3.16 KB
/
test_md.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
let b =
let open PrintBox in
let table =
frame
@@ grid_l
[
[ text "a"; text "looooooooooooooooooooooooo\noonng" ];
[
text "bx"; center_hv @@ frame @@ record [ "x", int 1; "y", int 2 ];
];
[
pad' ~col:2 ~lines:2 @@ text "?";
center_hv @@ record [ "x", int 10; "y", int 20 ];
];
]
in
let bold = text_with_style Style.bold in
let native =
grid_l
[
[ bold "header 1"; bold "header 2"; frame @@ bold "header 3" ];
[ line "cell 1.1"; frame @@ line "cell 1.2"; line "cell 1.3" ];
[ frame @@ line "cell 2.1"; line "cell 2.2"; bold "cell 2.3" ];
]
in
tree
(frame @@ text "root")
[
frame @@ text "child 1";
text_with_style Style.preformatted "child 2";
lines [ "line 1"; "line 2"; "line 3" ];
vlist ~bars:false
[
line "a row 1";
lines [ "a row 2.1"; "a row 2.2" ];
frame @@ line "a row 3";
];
vlist ~bars:true
[ line "b row 1"; lines [ "b row 2.1"; "b row 2.2" ]; bold "b row 3" ];
hlist ~bars:false
[
bold "a longiiish column 1";
line "a longiiish column 2";
frame @@ line "a longiiish column 3";
line "a longiiish column 4";
];
hlist ~bars:true
[
line "b longiiish column 1";
bold "b longiiish column 2";
line "b longiiish column 3";
frame @@ line "b longiiish column 4";
];
frame
@@ vlist ~bars:true
[
line "c row 1"; lines [ "c row 2.1"; "c row 2.2" ]; line "c row 3";
];
frame
@@ tree empty
[ tree (frame @@ text "header 3") [ frame @@ text "subchild 3" ] ];
tree empty
[
tree
(frame @@ text "header 4")
[
tree (text "<returns>")
[ text_with_style Style.preformatted "<nothing>" ];
text "& **subchild** 4";
];
];
frame
@@ tree
(text_with_style Style.preformatted "header 5")
[
lines_with_style Style.preformatted
[
"subchild 5";
" body 5";
" subbody 5";
"\tone tab end of sub 5";
"end of 5";
];
];
frame table;
native;
frame native;
]
let () = print_endline "Test default:"
let () = print_endline @@ PrintBox_md.(to_string Config.default) b
let () = print_endline "Test uniform unfolded:\n"
let () =
print_endline @@ PrintBox_md.(to_string Config.(unfolded_trees uniform)) b
let () = print_endline "Test foldable:"
let () =
print_endline @@ PrintBox_md.(to_string Config.(foldable_trees default)) b
let () = print_endline "Test uniform tab=2:"
let () = print_endline @@ PrintBox_md.(to_string Config.(tab_width 2 uniform)) b
let () = print_endline "Test single quote tab=2:"
let () =
print_endline
@@ PrintBox_md.(
to_string
Config.(tab_width 2 @@ multiline_preformatted Code_quote uniform))
b
let () = print_endline "The end."