logarion-2021/lib/category.ml
orbifx 6c27c7c6fb Draft
Basic unit renamed from Note to Text.

New modular text-parser, internal to Logarion, for generic notation parsing. The default input format is now a much plainer text.

Eliminated Meta module and generally lib/ modules.

New Store interface, with additional information from Store. For example the converter can now check filesystem dates. Changed to filesystem hardlinks for tracking publications & indexing, instead of categories. New commands `publish [-i]` and `deindex [-u]`. Categories are ignored now.

Logarion created texts have part of the UUID instead of a counter in their filename. New -i, --interactive flag for interactive creation & publication.

Logarion's index re-written in Messagepack format. Removed `indices` command. They are generated during `convert`.
2021-03-31 19:14:58 +01:00

23 lines
764 B
OCaml

module Category = struct
type t = Unlisted | Published | Invalid | Custom of string
let compare = Stdlib.compare
let of_string = function "unlisted" | "published" -> Invalid | c -> Custom c
let to_string = function Custom c -> c | _ -> ""
end
include Category
module CategorySet = struct
include Set.Make (Category)
let of_stringset s = String_set.fold (fun e a -> add (Category.of_string e) a) s empty
let of_query q = of_stringset (fst q), of_stringset (snd q)
let predicate (inc, exl) set = not (disjoint inc set) && disjoint exl set
let of_string x = of_stringset (String_set.of_string x)
let to_string set =
let f elt a =
let s = Category.to_string elt in
if a <> "" then a ^ ", " ^ s else s
in
fold f set ""
end