Build in note conversion

This commit is contained in:
Stavros Polymenis 2017-11-30 00:25:15 +00:00
parent 8def02d2cc
commit bb5316a3d4
2 changed files with 20 additions and 4 deletions

View File

@ -21,9 +21,20 @@ let header = header
let article = article
let note ~date ~abstract ~body =
let note ~abstract ~author ~date ~series ~topics ~keywords ~uuid ~body =
article [
details (summary [Unsafe.data abstract]) [time ~a:[a_datetime date] [pcdata date]];
details
(summary [Unsafe.data abstract])
[
br ();
a ~a:[a_rel [`Author]] [pcdata author];
pcdata " on ";
time ~a:[a_datetime date] [pcdata date];
div [pcdata ("Series: " ^ series)];
div [pcdata ("Topics: " ^ topics)];
div [pcdata ("Keywords: " ^ keywords)];
div [pcdata ("UUID: " ^ uuid)];
];
Unsafe.data body;
]

View File

@ -113,10 +113,15 @@ let note_page ?(header_template=None) ?(note_template=None) ~style url title not
| None ->
let open Logarion.Note in
let open Logarion.Meta in
let date = Date.(pretty_date @@ last note.meta.date) in
let abstract = note.meta.abstract in
let author = note.meta.author.name in
let date = Date.(pretty_date @@ last note.meta.date) in
let series = stringset_csv note.meta.series in
let topics = stringset_csv note.meta.topics in
let keywords = stringset_csv note.meta.keywords in
let uuid = Id.to_string note.meta.uuid in
let body = Omd.to_html (Omd.of_string note.body) in
Html.note ~date ~abstract ~body
Html.note ~abstract ~author ~date ~series ~topics ~keywords ~uuid ~body
in
Html.to_string @@ Html.page ~style url title (header_html header_template url title) note_html