logarion/lib/string_set.ml
orbifx 22fe21326f Samhain 21
Converter
- type selection
- subdir conversion
- htm extension

Gemini
- index.gmi
- topics and latest
- gmi.atom feed

Add pull (http(s)) operation
- peers.pub.conf and peers.priv.conf

HTML5 format & fixes by Novaburst
Phony target (thanks Gergely)

May

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.
Logarion created texts have part of the UUID in filename.
Logarion's index re-written in Messagepack format. Removed `indices` command. They are generated during `convert`.
2021-11-03 22:29:57 +00:00

15 lines
645 B
OCaml

include Set.Make(String)
let list_of_csv x = Re.Str.(split (regexp " *, *")) (String.trim x)
let of_string x = of_list (list_of_csv x)
let to_string ?(pre="") ?(sep=", ") s =
let j a x = match a, x with "", _ -> x | _, "" -> a | _ -> a ^ sep ^ x in
fold (fun x acc -> j acc x) s pre
let query string =
let partition (include_set, exclude_set) elt =
if String.get elt 0 = '!' then (include_set, add String.(sub elt 1 (length elt - 1)) exclude_set)
else (add elt include_set, exclude_set) in
List.fold_left partition (empty, empty) @@ list_of_csv string
let predicate (inc, exl) set = not (disjoint inc set) && disjoint exl set