move views to views folder

This commit is contained in:
2022-10-12 17:04:26 -06:00
parent 07dd08698c
commit e13348c8ae
10 changed files with 39 additions and 11 deletions

5
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,5 @@
{
"ocaml.sandbox": {
"kind": "global"
}
}

View File

@@ -1,12 +1,6 @@
(library (library
(name render) (name render)
(public_name rawleydotxyz.render) (public_name rawleydotxyz.render)
(libraries dream lwt database) (libraries dream lwt database views)
(preprocess (preprocess
(pps lwt_ppx))) (pps lwt_ppx)))
(rule
(targets index.ml layout.ml post_layout.ml blog_index.ml)
(deps index.eml.ml layout.eml.ml post_layout.eml.ml blog_index.eml.ml)
(action
(run dream_eml %{deps} --workspace %{workspace_root})))

View File

@@ -1,4 +1,5 @@
open Lwt open Lwt
open Views
module Blog_post = Database.Blog_post module Blog_post = Database.Blog_post

18
render/render.mli Normal file
View File

@@ -0,0 +1,18 @@
module Blog_post = Database.Blog_post
module type SimpleRender = sig val render : unit -> string end
val header_template : string
val footer_template : string
val replace_sequence : string -> string -> string -> string
val html_unescape : string -> string
val not_found_template : string
val error_template : string
val render_page : string -> string
val generate_link : Blog_post.t -> string
val generate_rss_item : Blog_post.t -> string
val handle_error : [< Caqti_error.t ] -> Dream.response Lwt.t
val handle_not_found : unit -> Dream.response Lwt.t
val render_blog_index : unit -> Dream.response Lwt.t
val render_rss_feed : Dream.request -> Dream.response Lwt.t
val render_simple : (module SimpleRender) -> Dream.response Lwt.t
val render_blog_post : slug:string -> Dream.response Lwt.t
val render_index : unit -> Dream.response Lwt.t

View File

@@ -4,9 +4,7 @@ body {
color: black; color: black;
margin: auto; margin: auto;
padding: 2px; padding: 2px;
font-family: 'Helvetica Neue', font-family: 'Helvetica Neue', 'Arial Nova', sans-serif;
'Arial Nova',
sans-serif;
} }
nav { nav {

12
views/dune Normal file
View File

@@ -0,0 +1,12 @@
(library
(name views)
(public_name rawleydotxyz.views)
(libraries dream lwt database)
(preprocess
(pps lwt_ppx)))
(rule
(targets index.ml layout.ml post_layout.ml blog_index.ml)
(deps index.eml.ml layout.eml.ml post_layout.eml.ml blog_index.eml.ml)
(action
(run dream_eml %{deps} --workspace %{workspace_root})))