aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/course.ml15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/course.ml b/src/course.ml
index 461c99c..6109a3e 100644
--- a/src/course.ml
+++ b/src/course.ml
@@ -59,15 +59,12 @@ let location_and_summary str category =
let parts = Astring.String.cuts ~empty:false ~sep str in
let _, location, summary =
List.fold_right
- (fun str (has_groups, location, summary) ->
- if not has_groups then
- check_groups str, "", ""
- else if location = "" then
- true, replace_entities str, ""
- else if summary = "" then
- true, replace_entities str, location
- else
- true, location, summary) parts (false, "", "") in
+ (fun str -> function
+ | false, _, _ -> check_groups str, "", ""
+ | true, "", _ -> true, replace_entities str, ""
+ | true, summary, "" -> true, replace_entities str, summary
+ | true, location, summary -> true, location, summary)
+ parts (false, "", "") in
if summary = "" then
location, category
else