@@ -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