aboutsummaryrefslogtreecommitdiff
path: root/lib/post.ml
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/post.ml33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/post.ml b/lib/post.ml
index 744e296..5c3d494 100644
--- a/lib/post.ml
+++ b/lib/post.ml
@@ -6,8 +6,41 @@ type t = {
tags : string list;
published : string;
author : string;
+ author_link : string;
}
+let published t = t.published
+
+(* RSS *)
+
+let to_rss_entry post =
+ Xml.tag "entry" []
+ [
+ Xml.tag "title" [] [ Xml.entry (post.author ^ " - " ^ post.link) ];
+ Xml.tag "id" [] [ Xml.entry post.link ];
+ Xml.tag "updated" [] [ Xml.entry post.published ];
+ Xml.tag "summary"
+ [ ("xml:lang", "\"en\""); ("type", "\"html\"") ]
+ [ Xml.entry post.summary ];
+ ]
+
+(* DB *)
+
+let db = ref []
+
+let add (entry : t) =
+ db := entry :: !db;
+ print_endline (entry.link ^ " added to db");
+ print_endline ("New db size: " ^ string_of_int (List.length !db))
+
+let get_all () =
+ print_endline ("db size: " ^ string_of_int (List.length !db));
+ !db
+
+let latest_post () = match !db with [] -> None | x :: _ -> Some x
+
+(* Mastodon integration *)
+
type mastodon_tag = {
kind : string; [@key "type"]
name : string;