summaryrefslogtreecommitdiff
path: root/lib/blog
diff options
context:
space:
mode:
Diffstat (limited to 'lib/blog')
-rwxr-xr-xlib/blog/dune21
-rwxr-xr-xlib/blog/hash_host/hash_blog.ml1
-rwxr-xr-xlib/blog/hash_host/hash_localhost.ml1
-rwxr-xr-xlib/blog/nord.ml2
-rwxr-xr-xlib/blog/sidebar.ml23
5 files changed, 48 insertions, 0 deletions
diff --git a/lib/blog/dune b/lib/blog/dune
new file mode 100755
index 0000000..648990f
--- /dev/null
+++ b/lib/blog/dune
@@ -0,0 +1,21 @@
+(rule
+ (targets hash_host.ml)
+ (enabled_if (= %{profile} dev))
+ (action (copy# hash_host/hash_localhost.ml hash_host.ml)))
+
+(rule
+ (targets hash_host.ml)
+ (enabled_if (<> %{profile} dev))
+ (action (copy# hash_host/hash_blog.ml hash_host.ml)))
+
+(library
+ (name blog)
+ (libraries
+ brr
+ brr.note
+ elements
+ )
+ (preprocess (pps ppx_hash))
+
+
+ )
diff --git a/lib/blog/hash_host/hash_blog.ml b/lib/blog/hash_host/hash_blog.ml
new file mode 100755
index 0000000..f5e172e
--- /dev/null
+++ b/lib/blog/hash_host/hash_blog.ml
@@ -0,0 +1 @@
+let expected_host = [%static_hash "blog.chimrod.com"]
diff --git a/lib/blog/hash_host/hash_localhost.ml b/lib/blog/hash_host/hash_localhost.ml
new file mode 100755
index 0000000..a41022e
--- /dev/null
+++ b/lib/blog/hash_host/hash_localhost.ml
@@ -0,0 +1 @@
+let expected_host = [%static_hash "localhost"]
diff --git a/lib/blog/nord.ml b/lib/blog/nord.ml
new file mode 100755
index 0000000..f0f2772
--- /dev/null
+++ b/lib/blog/nord.ml
@@ -0,0 +1,2 @@
+let nord0 = Jstr.v "#2e3440"
+let nord8 = Jstr.v "#81a1c1"
diff --git a/lib/blog/sidebar.ml b/lib/blog/sidebar.ml
new file mode 100755
index 0000000..1df0f1a
--- /dev/null
+++ b/lib/blog/sidebar.ml
@@ -0,0 +1,23 @@
+open StdLabels
+open Brr
+
+(** Return the sidebar *)
+let get
+ : unit -> El.t option
+ = fun () ->
+
+ List.find_opt (El.children @@ Document.body G.document)
+ ~f:(fun t -> El.has_tag_name El.Name.aside t)
+
+let rec clean
+ : El.t -> unit
+ = fun el ->
+ List.iter (El.children el)
+ ~f:(fun el ->
+ (* Remove the links from the sidebar, keep h1 and other stuff *)
+ if (El.has_tag_name (Jstr.v "nav") el)
+ || (El.has_tag_name (Jstr.v "ul") el) then
+ El.remove el
+ else
+ clean el
+ )