Implement members

This commit is contained in:
Reynir Björnsson 2023-02-16 13:09:52 +01:00
parent f3f0923337
commit 51883fdd20
4 changed files with 74 additions and 40 deletions

View file

@ -58,22 +58,6 @@ module Index = struct
@ (Metadata.Page.inject (module D) (Metadata.Page.make t.title t.description))
end
module About_us = struct
type t =
{ title : string option
; description : string option }
let make page =
{ title= Metadata.Page.title page
; description= Metadata.Page.description page }
let inject (type a) (module D : Key_value.DESCRIBABLE with type t = a) t =
D.[ "active", object_ $ [ "page", string "about_us" ]
; "page", object_ $ [ "title", string (Option.value ~default:"" t.title)
; "description", string (Option.value ~default:"" t.description) ] ]
@ (Metadata.Page.inject (module D) (Metadata.Page.make t.title t.description))
end
module Person = struct
type t =
{ name : string
@ -86,11 +70,47 @@ module Person = struct
obj |> V.object_and @@ fun assoc ->
make <$> V.(required_assoc string) "name" assoc <*> V.(required_assoc string) "website" assoc
let from_string (module V : Metadata.VALIDABLE) = function
| None -> Validate.error $ Error.Required_metadata [ "Person" ]
| Some str ->
let open Validate.Monad in
V.from_string str
>>= V.object_and @@ fun assoc ->
let open Validate.Applicative in
make
<$> V.(required_assoc string) "name" assoc
<*> V.(required_assoc string) "website" assoc
let inject (type a) (module D : Key_value.DESCRIBABLE with type t = a) t =
D.[ "name", string t.name
; "website", string t.website ]
end
module About_us = struct
type t =
{ title : string option
; description : string option
; current_members : (Person.t * string) list
; former_members : (Person.t * string) list }
let make ~current_members ~former_members page =
{ title= Metadata.Page.title page
; description= Metadata.Page.description page
; current_members
; former_members }
let inject (type a) (module D : Key_value.DESCRIBABLE with type t = a) t =
D.[ "active", object_ $ [ "page", string "about_us" ]
; "page", object_ $ [ "title", string (Option.value ~default:"" t.title)
; "description", string (Option.value ~default:"" t.description) ]
; "team", object_ $ [ "body", string "FIXME"
; "current_members", list (List.map (fun (p, desc) ->
object_ (("description", string desc) :: Person.inject (module D) p)) t.current_members)
; "former_members", list (List.map (fun (p, desc) ->
object_ (("description", string desc) :: Person.inject (module D) p)) t.former_members) ] ]
@ (Metadata.Page.inject (module D) (Metadata.Page.make t.title t.description))
end
module With_robur (V : Metadata.INJECTABLE) = struct
type t =
{ robur : Robur.t

View file

@ -20,13 +20,14 @@ module Person : sig
val make : string -> string -> t
val from : (module Metadata.VALIDABLE with type t = 'a) -> 'a -> t Validate.t
val from_string : (module Metadata.VALIDABLE) -> string option -> t Validate.t
include Metadata.INJECTABLE with type t := t
end
module About_us : sig
type t
val make : Metadata.Page.t -> t
val make : current_members:(Person.t * string) list -> former_members:(Person.t * string) list -> Metadata.Page.t -> t
include Metadata.INJECTABLE with type t := t
end

View file

@ -52,8 +52,19 @@ let generate_index target =
let generate_about_us target =
let open Build in
let read_members dir =
Build.collection
(read_child_files dir (with_extension "md"))
(fun member ->
Metaformat.read_file_with_metadata (module Model.Person) member
>>> snd Markup.to_html)
(fun x () -> x) in
let* current_members = read_members "metadata/current_members" in
let* former_members = read_members "metadata/former_members" in
let read_model =
(Metaformat.read_file_with_metadata (module Metadata.Page) "pages/about_us.md")
>>^ fun (page, content) ->
Model.About_us.make page, content in
current_members
&&& former_members
&&& (Metaformat.read_file_with_metadata (module Metadata.Page) "pages/about_us.md")
>>^ fun ((current_members, former_members), (page, content)) ->
Model.About_us.make ~current_members ~former_members page, content in
with_layout (module Model.About_us) read_model (about_us_html target)

View file

@ -26,34 +26,36 @@
{{ team.body }}
{% endautoescape -%}
</div>
<div class="col-md-12">
<h3>Current members</h3>
</div>
<div class="tekst-element">
<div class="col-md-12 p0">
{% for member in team.current_members %}
<div class="col-md-6">
<p class="underoverskrift">STEFANIE</p>
<p class="brødtekst">Stefanie is an infrastructure software engineer and a researcher.She studied Applied Computer Science in the Natural Sciences, and developed a typechecker for a compiler of a language for optimization problems. In her PhD project she developed metrics to compare forest data structures, with an application in molecular</p>
<p class="underoverskrift">{{ member.name }}</p>
{%- autoescape false -%}
<!-- FIXME: put class="brødtekst" on the <p>s -->
{{ member.description }}
{% endautoescape -%}
</div>
<div class="col-md-6">
<p class="underoverskrift">HANNES</p>
<p class="brødtekst">C higher-order separation logic and the theorem prover Coq). Hannes co-authored not-quite-so-broken TLS, a TLS implementation from the ground up in OCaml, and contributes to the MirageOS project as a core team member. He is working on various projects, including opam signing and netsem, an executable formal model of TCP/IP</p>
{% endfor %}
</div>
</div>
<div class="col-md-12">
<h3>Former members</h3>
</div>
<div class="tekst-element">
<div class="col-md-12 p0">
{% for member in team.former_members %}
<div class="col-md-6">
<p class="underoverskrift">MARTIN</p>
<p class="brødtekst">Martin has been programming since before programming was trendy, eating Sharp SC61860A machine code for breakfast since before it was healthy, and using Linux way back when it was just Linus Torvalds glorified terminal emulator.A founding member of Unikernel Systems (later acquired by Docker), Martin has been involved in a number</p>
</div>
<div class="col-md-6">
<p class="underoverskrift">MINDY</p>
<p class="brødtekst">Mindy ran the first MirageOS unikernel in the public cloud in 2014. Mindy has worked extensively on the MirageOS TCP/IP network stack and various protocol implementations, and is a member of the project's core team. She managed the release of MirageOS's latest major version.</p>
</div>
</div>
<div class="col-md-12 p0">
<div class="col-md-6 ">
<p class="underoverskrift">JOE</p>
<p class="brødtekst">Joe is an independent IT consultant located in Copenhagen. Joe has a background in penetration testing, protocol design, applied cryptography, and architectural IT security system design for customers, especially in the banking, insurance, and pension fund sectors. He has been consulting on BPAY integration in Australia, and conducting</p>
<p class="underoverskrift">{{ member.name }}</p>
{%- autoescape false -%}
<!-- FIXME: put class="brødtekst" on the <p>s -->
{{ member.description }}
{% endautoescape -%}
</div>
{% endfor %}
</div>
</div>
</div>