diff options
author | Sébastien Dailly <sebastien@dailly.me> | 2022-02-07 15:38:37 +0100 |
---|---|---|
committer | Sébastien Dailly <sebastien@dailly.me> | 2022-02-07 16:01:12 +0100 |
commit | 77544bdfad2af41514ec1435f706fee87ea2969e (patch) | |
tree | 4de23870e08711da25ff92e9670370fc0a74e459 /lib/blog | |
parent | ad526111f0dd619ae9e0e98ef2253146b58a068f (diff) |
Added viz.js code
Diffstat (limited to 'lib/blog')
-rwxr-xr-x | lib/blog/dune | 21 | ||||
-rwxr-xr-x | lib/blog/hash_host/hash_blog.ml | 1 | ||||
-rwxr-xr-x | lib/blog/hash_host/hash_localhost.ml | 1 | ||||
-rwxr-xr-x | lib/blog/nord.ml | 2 | ||||
-rwxr-xr-x | lib/blog/sidebar.ml | 23 |
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 + ) |