-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
350 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
page_title: Index | ||
description: Test de description | ||
--- | ||
|
||
Index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ type elt = { | |
|
||
type t = elt list | ||
|
||
let empty = [] | ||
|
||
let from_member_list = function | ||
| [] -> [] | ||
| x :: xs -> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
type t = { page : Model.Page.t; chain : Chain.t; interests : Model.Link.t list } | ||
|
||
let entity_name = "Parge" | ||
|
||
let neutral = | ||
Ok { page = Model.Page.empty; chain = Chain.empty; interests = [] } | ||
|
||
let validate = | ||
let open Yocaml.Data.Validation in | ||
record (fun fields -> | ||
let+ page = Model.Page.validate_underlying_page fields | ||
and+ interests = | ||
optional_or ~default:[] fields "interests" (list_of Model.Link.validate) | ||
in | ||
{ page; interests; chain = Chain.empty }) | ||
|
||
let merge_chain chain = | ||
Yocaml.Task.lift ~has_dynamic_dependencies:false (fun x -> { x with chain }) | ||
|
||
let normalize { page; chain; interests } = | ||
let open Yocaml.Data in | ||
let len = List.length interests in | ||
let interests = | ||
List.mapi | ||
(fun i link -> | ||
let sep = | ||
if i >= len - 1 then "" else if i >= len - 2 then " and " else ", " | ||
in | ||
record (("sep", string sep) :: Model.Link.normalize_underlying_link link)) | ||
interests | ||
in | ||
let members = | ||
chain | ||
|> Chain.to_list | ||
|> List.map (fun (curr, (pred, succ)) -> | ||
record | ||
(("pred", record @@ Model.Member.normalize pred) | ||
:: ("succ", record @@ Model.Member.normalize succ) | ||
:: Model.Member.normalize curr)) | ||
in | ||
Model.Page.normalize page | ||
@ [ | ||
("has_interest", bool @@ List.is_empty interests); | ||
("interests", list interests); | ||
("chain", list members); | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
(** Describes an index. *) | ||
|
||
type t | ||
(** The type describing the index. *) | ||
|
||
val merge_chain : Chain.t -> (t, t) Yocaml.Task.t | ||
|
||
(** {1 Dealing as metadata} *) | ||
|
||
include Yocaml.Required.DATA_READABLE with type t := t | ||
include Yocaml.Required.DATA_INJECTABLE with type t := t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.