File tree Expand file tree Collapse file tree 3 files changed +6
-12
lines changed Expand file tree Collapse file tree 3 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -182,14 +182,6 @@ let run_toplevel_tests ?root c ppf tests t =
182182 ) tests;
183183 Block. pp_footer ppf ()
184184
185- let trim l =
186- let rec trim_front = function
187- | "" ::t -> trim_front t
188- | l -> l
189- in
190- let rev_trim l = trim_front (List. rev (trim_front l)) in
191- rev_trim (List. rev_map String. trim l)
192-
193185type file = { first : Mdx_top.Part .file ; current : Mdx_top.Part .file }
194186
195187let files: (string , file) Hashtbl. t = Hashtbl. create 8
@@ -227,8 +219,8 @@ let update_block_with_file ppf t file part =
227219 (match part with None -> " " | Some p -> p)
228220 file
229221 | Some lines ->
230- let lines = trim lines in
231222 let contents = String. concat " \n " lines in
223+ let contents = String. trim contents in
232224 Output. pp ppf (`Output contents);
233225 Block. pp_footer ppf ()
234226
Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ let rec remove_empty_heads = function
3535 | "" :: tl -> remove_empty_heads tl
3636 | l -> l
3737
38+ let trim_empty_rev l =
39+ remove_empty_heads (List. rev (remove_empty_heads l))
40+
3841module Parse_parts =
3942struct
4043
4750 ws; str " ]" ; ws; opt (str " ;;" ); ws;
4851 ]
4952
50- let next_part ~name ~sep_indent = fun lines ->
51- let body = String. concat " \n " (List. rev (remove_empty_heads lines) ) in
53+ let next_part ~name ~sep_indent = fun lines_rev ->
54+ let body = String. concat " \n " (trim_empty_rev lines_rev ) in
5255 Part. v ~name ~sep_indent ~body
5356
5457 let next_part_of_groups groups =
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ let f = "hello world!"
1919
2020[@@@part "42"] ;;
2121
22-
2322let () =
2423 f x print_int
2524
You can’t perform that action at this time.
0 commit comments