Add style path parameter to Html.of_note and use custom style path for html exports
This commit is contained in:
parent
6bfb636d8e
commit
52d2ee9f93
@ -3,7 +3,7 @@ open Logarion
|
||||
|
||||
let to_string tyxml = Format.asprintf "%a" (Tyxml.Html.pp ()) tyxml
|
||||
|
||||
let head ?(style="/static/main.css") t =
|
||||
let head ~style t =
|
||||
head (title (pcdata t)) [
|
||||
link ~rel:[`Stylesheet] ~href:style ();
|
||||
link ~rel:[`Alternate] ~href:"/feed.atom" ~a:[a_mime_type "application/atom+xml"] ();
|
||||
@ -15,8 +15,10 @@ let logarion_header ?(header_tpl=None) blog_url title =
|
||||
| Some (Template.Header s) -> Unsafe.data Template.(fold_header blog_url title s)
|
||||
| None -> header [ h1 [ pcdata title] ]
|
||||
|
||||
let logarion_page ?(header_tpl=None) blog_url head_title header_title main =
|
||||
html (head head_title) (body [ logarion_header ~header_tpl blog_url header_title; main ])
|
||||
let default_style = "/static/main.css"
|
||||
|
||||
let logarion_page ?(style=default_style) ?(header_tpl=None) blog_url head_title header_title main =
|
||||
html (head ~style head_title) (body [ logarion_header ~header_tpl blog_url header_title; main ])
|
||||
|
||||
let logarion_note ?(note_tpl=None) ymd =
|
||||
match note_tpl with
|
||||
@ -32,8 +34,9 @@ let logarion_note ?(note_tpl=None) ymd =
|
||||
Unsafe.data ymd_body;
|
||||
]
|
||||
|
||||
let of_note ?(header_tpl=None) ?(note_tpl=None) blog_url lgrn ymd =
|
||||
let of_note ?(style=default_style) ?(header_tpl=None) ?(note_tpl=None) blog_url lgrn ymd =
|
||||
logarion_page
|
||||
~style
|
||||
~header_tpl
|
||||
blog_url
|
||||
(Note.title ymd ^ " by " ^ ymd.Note.meta.Meta.author.Meta.Author.name)
|
||||
|
@ -122,7 +122,7 @@ let convert directory =
|
||||
let archive = L.{ config; store } in
|
||||
let notes = File.to_list L.note_lens archive.store in
|
||||
|
||||
let page_of_note = Converters.Html.of_note "locahost" config in
|
||||
let page_of_note = Converters.Html.of_note ~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
|
||||
|
Loading…
x
Reference in New Issue
Block a user