make serve function
This commit is contained in:
@@ -10,7 +10,7 @@ let spec =
|
||||
" Consider all remaining arguments as input file names.";
|
||||
]
|
||||
|
||||
|
||||
(** Utitilies *)
|
||||
let with_open_in fn f =
|
||||
let ic = open_in fn in
|
||||
match f ic with
|
||||
@@ -34,6 +34,8 @@ let read_metadata ic =
|
||||
| _ -> lst
|
||||
in go []
|
||||
|
||||
(** Functions for processing an individual post *)
|
||||
|
||||
let format_post ~title ~tags ~date ~contents =
|
||||
String.concat "" [
|
||||
{|<!DOCTYPE html>
|
||||
@@ -69,6 +71,7 @@ let format_post ~title ~tags ~date ~contents =
|
||||
</body>|}]
|
||||
|
||||
|
||||
(* convert contents from [ic] to a post webpage, output to [oc] *)
|
||||
let process ic oc =
|
||||
let metadata = read_metadata ic in
|
||||
let lookup_metadata k =
|
||||
|
||||
Reference in New Issue
Block a user