Skip to content

Commit 67380d6

Browse files
RCmercitiensonqin
authored andcommitted
Apply formatting changes
1 parent c486778 commit 67380d6

File tree

2 files changed

+45
-42
lines changed

2 files changed

+45
-42
lines changed

lib/syntax/block0.ml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ struct
2929
char '>'
3030
*> lines_while
3131
( spaces *> optional (char '>') *> spaces *> line >>= fun line ->
32-
if not (starts_with line "- " || starts_with line "# " || starts_with line "id:: " || line = "-" || line = "#") then
32+
if
33+
not
34+
(starts_with line "- " || starts_with line "# "
35+
|| starts_with line "id:: " || line = "-" || line = "#")
36+
then
3337
return line
3438
else
3539
fail "new block" )
@@ -144,7 +148,7 @@ struct
144148
else
145149
List.map
146150
(fun line ->
147-
(* FIXME: only remove blanks *)
151+
(* FIXME: only remove blanks *)
148152
safe_sub line indent (String.length line - indent))
149153
lines
150154
in

lib/syntax/heading0.ml

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -139,48 +139,47 @@ struct
139139
let title, tags =
140140
match title with
141141
| [] -> (title, [])
142-
| _ ->
142+
| _ -> (
143143
match config.format with
144-
| Org ->
145-
(
146-
let last_inline = List.nth title (List.length title - 1) in
147-
match last_inline with
148-
| Inline.Plain s, _ ->
149-
let s = String.trim s in
150-
if String.length s > 1 && s.[String.length s - 1] = ':' then
151-
let prefix, maybe_tags = splitr (fun c -> c <> ' ') s in
152-
match parse_string ~consume:All tags maybe_tags with
153-
| Ok tags ->
154-
let title =
155-
if prefix = "" then
156-
drop_last 1 title
157-
else
158-
drop_last 1 title
159-
@ Type_op.inline_list_with_none_pos
144+
| Org -> (
145+
let last_inline = List.nth title (List.length title - 1) in
146+
match last_inline with
147+
| Inline.Plain s, _ ->
148+
let s = String.trim s in
149+
if String.length s > 1 && s.[String.length s - 1] = ':' then
150+
let prefix, maybe_tags = splitr (fun c -> c <> ' ') s in
151+
match parse_string ~consume:All tags maybe_tags with
152+
| Ok tags ->
153+
let title =
154+
if prefix = "" then
155+
drop_last 1 title
156+
else
157+
drop_last 1 title
158+
@ Type_op.inline_list_with_none_pos
160159
[ Inline.Plain prefix ]
161-
in
162-
let open Option in
163-
let last_plain =
164-
List.nth_opt title (List.length title - 1)
165-
>>| fun (inline_t, pos) ->
166-
( (match inline_t with
167-
| Inline.Plain s -> Inline.Plain (String.rtrim s ^ " ")
168-
| _ -> inline_t)
169-
, pos )
170-
in
171-
let title' =
172-
if Option.is_some last_plain then
173-
let _, butlast_title = butlast title in
174-
List.append butlast_title [ Option.get last_plain ]
175-
else
176-
title
177-
in
178-
(title', remove is_blank tags)
179-
| _ -> (title, [])
180-
else
181-
(title, [])
182-
| _ -> (title, []))
183-
| Markdown -> (title, [])
160+
in
161+
let open Option in
162+
let last_plain =
163+
List.nth_opt title (List.length title - 1)
164+
>>| fun (inline_t, pos) ->
165+
( (match inline_t with
166+
| Inline.Plain s -> Inline.Plain (String.rtrim s ^ " ")
167+
| _ -> inline_t)
168+
, pos )
169+
in
170+
let title' =
171+
if Option.is_some last_plain then
172+
let _, butlast_title = butlast title in
173+
List.append butlast_title [ Option.get last_plain ]
174+
else
175+
title
176+
in
177+
(title', remove is_blank tags)
178+
| _ -> (title, [])
179+
else
180+
(title, [])
181+
| _ -> (title, []))
182+
| Markdown -> (title, []))
184183
in
185184
let anchor =
186185
anchor_link (Inline.asciis (Type_op.inline_list_strip_pos title))

0 commit comments

Comments
 (0)