introduced ymd mli
This commit is contained in:
parent
5e128c25b9
commit
b1b1f648c7
7
Makefile
7
Makefile
@ -17,9 +17,16 @@ logarion.cmx: src/logarion.ml ymd.cmx
|
|||||||
ymd.cmx src/logarion.ml
|
ymd.cmx src/logarion.ml
|
||||||
|
|
||||||
ymd.cmx: src/ymd.ml
|
ymd.cmx: src/ymd.ml
|
||||||
|
ocamlfind ocamlc -c -o ymd.cmi -linkpkg \
|
||||||
|
-package batteries,omd,lens,lens.ppx_deriving,ptime,re \
|
||||||
|
src/ymd.mli
|
||||||
ocamlfind ocamlopt -c -o ymd.cmx -linkpkg \
|
ocamlfind ocamlopt -c -o ymd.cmx -linkpkg \
|
||||||
-package batteries,omd,lens,lens.ppx_deriving,ptime,re \
|
-package batteries,omd,lens,lens.ppx_deriving,ptime,re \
|
||||||
src/ymd.ml
|
src/ymd.ml
|
||||||
|
|
||||||
|
ymd.mli: src/ymd.ml
|
||||||
|
ocamlfind ocamlc -i src/ymd.ml \
|
||||||
|
-package batteries,omd,lens,lens.ppx_deriving,ptime,re > src/ymd.mli
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f src/*.{cmx,cmi,o} *.{cmx,cmi,o}
|
rm -f src/*.{cmx,cmi,o} *.{cmx,cmi,o}
|
||||||
|
66
src/ymd.mli
Normal file
66
src/ymd.mli
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
|
||||||
|
|
||||||
|
type author = { name : string; email : string; }
|
||||||
|
type date = { edited : Ptime.t option; published : Ptime.t option; }
|
||||||
|
type meta = {
|
||||||
|
title : string;
|
||||||
|
author : author;
|
||||||
|
date : date;
|
||||||
|
categories : string list;
|
||||||
|
topics : string list;
|
||||||
|
keywords : string list;
|
||||||
|
series : string list;
|
||||||
|
abstract : string;
|
||||||
|
}
|
||||||
|
type ymd = { meta : meta; body : string; }
|
||||||
|
|
||||||
|
val blank_meta : meta
|
||||||
|
val blank_ymd : ymd
|
||||||
|
|
||||||
|
val filename_of_title : string -> string
|
||||||
|
(** get how a file should be named according to a title [string] *)
|
||||||
|
|
||||||
|
val filename : ymd -> string
|
||||||
|
(** get how a file should be named based on a [ymd] value *)
|
||||||
|
|
||||||
|
(** {1 Conversions from and to string} *)
|
||||||
|
|
||||||
|
val of_string : string -> ymd
|
||||||
|
(** convert a string containing a ymd buffer to [ymd] **)
|
||||||
|
|
||||||
|
val to_string : ymd -> string
|
||||||
|
(** convert a ymd to a [string] *)
|
||||||
|
|
||||||
|
val meta_of_yaml : string -> meta
|
||||||
|
val with_kv : ymd -> string * string -> ymd
|
||||||
|
|
||||||
|
val trim_str : string -> string
|
||||||
|
val list_of_csv : string -> string list
|
||||||
|
val of_str : 'a -> ('a, string) Lens.t -> string -> 'a
|
||||||
|
val of_str_list : 'a -> ('a, string list) Lens.t -> string -> 'a
|
||||||
|
|
||||||
|
val meta_pair_of_string : string -> string * string
|
||||||
|
val with_meta_kv : meta -> string * string -> meta
|
||||||
|
|
||||||
|
(** {1 Conversions from and to date) *)
|
||||||
|
|
||||||
|
val rfc_string_of : Ptime.t option -> string
|
||||||
|
val date_of : string -> Ptime.t option
|
||||||
|
val date_string : ymd -> Ptime.t option
|
||||||
|
|
||||||
|
(** {1 Lenses for accessing [ymd] record fields} *)
|
||||||
|
|
||||||
|
val author_name : (author, string) Lens.t
|
||||||
|
val author_email : (author, string) Lens.t
|
||||||
|
val date_edited : (date, Ptime.t option) Lens.t
|
||||||
|
val date_published : (date, Ptime.t option) Lens.t
|
||||||
|
val meta_title : (meta, string) Lens.t
|
||||||
|
val meta_author : (meta, author) Lens.t
|
||||||
|
val meta_date : (meta, date) Lens.t
|
||||||
|
val meta_categories : (meta, string list) Lens.t
|
||||||
|
val meta_topics : (meta, string list) Lens.t
|
||||||
|
val meta_keywords : (meta, string list) Lens.t
|
||||||
|
val meta_series : (meta, string list) Lens.t
|
||||||
|
val meta_abstract : (meta, string) Lens.t
|
||||||
|
val ymd_meta : (ymd, meta) Lens.t
|
||||||
|
val ymd_body : (ymd, string) Lens.t
|
Loading…
x
Reference in New Issue
Block a user