implement UUID for articles

This commit is contained in:
Stavros Polymenis 2016-10-21 19:35:37 +01:00
parent 65dcc3f72e
commit 95bda3e4a1
2 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
OCB_FLAGS = -use-ocamlfind -I src # -I lib
OCB = ocamlbuild $(OCB_FLAGS)
PKGS = toml,opium.unix,omd,str,batteries,tyxml,lens,ptime,ptime.clock.os,re.str,lens.ppx_deriving,mustache
PKGS = toml,uuidm,opium.unix,omd,str,batteries,tyxml,lens,ptime,ptime.clock.os,re.str,lens.ppx_deriving,mustache
all: web

View File

@ -38,6 +38,7 @@ type meta = {
keywords: string list;
series: string list;
abstract: string;
uuid: Uuidm.t
} [@@deriving lens]
type ymd = {
@ -50,7 +51,8 @@ let blank_meta = {
author = Author.({ name = ""; email = "" });
date = Date.({ edited = None; published = None });
categories = []; topics = []; keywords = []; series = [];
abstract = ""
abstract = "";
uuid = Uuidm.v4_gen (Random.get_state ()) ();
}
let blank_ymd = { meta = blank_meta; body = "" }
@ -121,6 +123,7 @@ let make ?(author_name="") ?(author_email="") ?(date_published=None) ?(date_edit
categories;
series;
abstract;
uuid = Uuidm.v4_gen (Random.get_state ()) ();
author = {
Author.name = author_name;
Author.email = author_email;
@ -150,6 +153,7 @@ let to_string ymd =
"\nkeywords: "; String.concat ", " ymd.meta.keywords;
"\nseries: "; String.concat ", " ymd.meta.series;
"\nabstract: "; ymd.meta.abstract;
"\nuuid: "; Uuidm.to_string ymd.meta.uuid;
"\n---\n"; ymd.body;
];
Buffer.contents buf