finished implementation of lens
This commit is contained in:
parent
3b35f6ce2f
commit
42df13ce29
4
Makefile
4
Makefile
@ -12,4 +12,6 @@ html.cmx: src/html.ml logarion.cmx
|
||||
logarion.cmx src/html.ml
|
||||
|
||||
logarion.cmx: src/logarion.ml
|
||||
ocamlfind ocamlopt -c -o logarion.cmx -linkpkg -package omd,lens src/logarion.ml
|
||||
ocamlfind ocamlopt -c -o logarion.cmx -linkpkg \
|
||||
-package omd,lens,lens.ppx_deriving \
|
||||
src/logarion.ml
|
||||
|
@ -1,5 +1,5 @@
|
||||
open Lens
|
||||
|
||||
|
||||
type author = {
|
||||
name: string;
|
||||
email: string;
|
||||
|
@ -28,8 +28,8 @@ let ymd_of_body_pairs pairs =
|
||||
let open Logarion in
|
||||
let open Lens.Infix in
|
||||
let field_of_pair ymd (key, value) = match key with
|
||||
| "title" -> { ymd with meta = { ymd.meta with title = List.hd value } }
|
||||
(* | "author" -> ((ymd_t_meta |-- log_meta_t_author |-- author_t_name_t) ^= List.hd value) ymd *)
|
||||
| "title" -> ((ymd_meta |-- meta_title |-- title ^= List.hd value) ymd
|
||||
| "author" -> ((ymd_meta |-- meta_author |-- author_name) ^= List.hd value) ymd
|
||||
| "text" -> { ymd with body = List.hd value }
|
||||
| _ -> ymd
|
||||
in
|
||||
|
Loading…
x
Reference in New Issue
Block a user