1
- type location = { lat : float ; long : float }
2
- [@@ deriving of_yaml , show { with_path = false }]
3
-
4
- type course = {
5
- name : string ;
6
- acronym : string option ;
7
- online_resource : string option ;
8
- }
9
- [@@ deriving of_yaml , show { with_path = false }]
1
+ open Data_intf.Academic_institution
10
2
11
3
type metadata = {
12
4
name : string ;
@@ -17,25 +9,9 @@ type metadata = {
17
9
courses : course list ;
18
10
location : location option ;
19
11
}
20
- [@@ deriving of_yaml ]
12
+ [@@ deriving of_yaml , stable_record ~version: t ~add: [ body_md ; body_html ; slug ] ]
21
13
22
- type t = {
23
- name : string ;
24
- slug : string ;
25
- description : string ;
26
- url : string ;
27
- logo : string option ;
28
- continent : string ;
29
- courses : course list ;
30
- location : location option ;
31
- body_md : string ;
32
- body_html : string ;
33
- }
34
- [@@ deriving
35
- stable_record ~version: metadata ~remove: [ body_md ; body_html ; slug ],
36
- show { with_path = false }]
37
-
38
- let of_metadata m = of_metadata m ~slug: (Utils. slugify m.name)
14
+ let of_metadata m = metadata_to_t m ~slug: (Utils. slugify m.name)
39
15
40
16
let decode (fpath , (head , body_md )) =
41
17
let metadata =
@@ -49,29 +25,7 @@ let decode (fpath, (head, body_md)) =
49
25
let all () = Utils. map_files decode " academic_institutions/*.md"
50
26
51
27
let template () =
52
- Format. asprintf
53
- {|
54
- type location = { lat : float ; long : float }
55
-
56
- type course =
57
- { name : string
58
- ; acronym : string option
59
- ; online_resource : string option
60
- }
61
-
62
- type t =
63
- { name : string
64
- ; slug : string
65
- ; description : string
66
- ; url : string
67
- ; logo : string option
68
- ; continent : string
69
- ; courses : course list
70
- ; location : location option
71
- ; body_md : string
72
- ; body_html : string
73
- }
74
-
28
+ Format. asprintf {|
75
29
let all = % a
76
30
| }
77
31
(Fmt. brackets (Fmt. list pp ~sep: Fmt. semi))
0 commit comments