diff --git a/src/converters/html.ml b/src/converters/html.ml index bfd9f0e..ca60316 100644 --- a/src/converters/html.ml +++ b/src/converters/html.ml @@ -15,7 +15,7 @@ let default_style = "/static/main.css" let page ?(style=default_style) blog_url head_title header main = html (head ~style head_title) (body [ header; main ]) -let heading1 data = h1 [ pcdata data ] +let heading1 = h1 let header = header diff --git a/src/converters/template.ml b/src/converters/template.ml index 54289a1..c16efe1 100644 --- a/src/converters/template.ml +++ b/src/converters/template.ml @@ -47,12 +47,12 @@ let front ps = map_tpl_opt (fun v -> Front v) ps.Configuration.front ps let list ps = map_tpl_opt (fun v -> List v) ps.Configuration.list ps let item ps = map_tpl_opt (fun v -> Item v) ps.Configuration.item ps -let string s = Html.data s -let section ~inverted name contents = Html.unescaped_data ("section " ^ String.concat "." name) -let unescaped elts = Html.unescaped_data "use escaped instead" -let partial ?indent name _ _ = Html.data "partials not supported" -let comment _ = Html.data "" -let concat l = l +let string s = [Html.data s] +let section ~inverted name contents = [Html.unescaped_data ("section " ^ String.concat "." name)] +let unescaped elts = [Html.unescaped_data "use escaped instead"] +let partial ?indent name _ _ = [Html.data "partials not supported"] +let comment _ = [Html.data ""] +let concat = List.concat let escaped_meta (meta : Logarion.Meta.t) e = let open Logarion in @@ -64,13 +64,12 @@ let escaped_meta (meta : Logarion.Meta.t) e = | tag -> Meta.value_with_name meta tag let escaped_note note e = match List.hd e with - | "body" -> Html.unescaped_data @@ Omd.to_html @@ Omd.of_string note.Logarion.Note.body - | _ -> Html.unescaped_data @@ escaped_meta note.Logarion.Note.meta e + | "body" -> [Html.unescaped_data @@ Omd.to_html @@ Omd.of_string note.Logarion.Note.body] + | _ -> [Html.unescaped_data @@ escaped_meta note.Logarion.Note.meta e] -let escaped_header blog_url title e = match List.hd e with - (* | "blog_url" -> *) - | "title" -> Html.heading1 title - | tag -> prerr_endline ("unknown tag: " ^ tag); Html.unescaped_data "" +let escaped_header archive e = match List.hd e with + | "title" -> [Html.heading1 [Html.anchor ("index.html") [Html.data archive.Logarion.Archive.Configuration.title]]] + | tag -> prerr_endline ("unknown tag: " ^ tag); [Html.unescaped_data ""] let anchor_of_meta meta = let module Meta = Logarion.Meta in @@ -84,7 +83,7 @@ let listing metas = let open Html in list_unordered @@ List.map (fun m -> list_item @@ anchor_of_meta @@ m) metas -let escaped_index ~from ~n metas e = Html.data "temp" +let escaped_index ~from ~n metas e = [Html.data "temp"] (* match List.hd e with *) (* | "navigation" -> *) (* "" *) @@ -100,16 +99,17 @@ let escaped_index ~from ~n metas e = Html.data "temp" (* Logarion.Meta.StringSet.fold (fun e a -> a ^ "