diff --git a/src/converters/html.ml b/src/converters/html.ml index dbe9fd3..145efb7 100644 --- a/src/converters/html.ml +++ b/src/converters/html.ml @@ -53,9 +53,10 @@ let article_link meta = in li [ a ~a:[ a_href (uri_of_string u) ] [ d ] ] -let of_entries ?(header_tpl=None) ?(list_tpl=None) ?(item_tpl=None) ?(from=0) ?(n=0) blog_url lgrn notes = +let of_entries ?(style=default_style) ?(header_tpl=None) ?(list_tpl=None) ?(item_tpl=None) ?(from=0) ?(n=0) blog_url lgrn notes = let title = Logarion.(lgrn.Archive.Configuration.title) in logarion_page + ~style ~header_tpl blog_url title diff --git a/src/logarion_cli.ml b/src/logarion_cli.ml index 05937ac..e5efdf7 100644 --- a/src/logarion_cli.ml +++ b/src/logarion_cli.ml @@ -121,18 +121,22 @@ let convert directory = let store = File.store config.repository in let archive = L.{ config; store } in let notes = File.to_list L.note_lens archive.store in + let metas = File.to_list L.meta_lens archive.store in let page_of_note = Converters.Html.of_note ~style:"static/main.css" "localhost" config in + let page_of_note_listing = Converters.Html.of_entries ~style:"static/main.css" "localhost" config in let path_of_note note = directory ^ "/" ^ Meta.string_alias Note.(note.meta.Meta.title) ^ ".html" in - let file_creation note = - let out = open_out @@ path_of_note note in - output_string out @@ page_of_note note; + let file_creation path content = + let out = open_out path in + output_string out content; close_out out in match create_dir directory |> create_dir_msg ~descr:"export" directory with | Ok _ -> (match copy ~recursive:true ".logarion/static" (directory) with - | Ok _ -> List.iter file_creation notes + | Ok _ -> + List.iter (fun note -> file_creation (path_of_note note) (page_of_note note)) notes; + file_creation (directory ^ "/index.html") (page_of_note_listing metas); | Error (`Msg m) -> prerr_endline m) | Error _ -> ()