diff --git a/src/html.ml b/src/html.ml
index aafe2bd..ea58689 100644
--- a/src/html.ml
+++ b/src/html.ml
@@ -55,39 +55,48 @@ let of_file_meta_pairs ?(header_tpl=None) ?(listing_tpl=None) blog_url lgrn file
|> to_string
let form ?(header_tpl=None) blog_url lgrn ymd =
- let input_set title name value =
- p [ label [ span [pcdata title]; input ~a:[a_name name; a_value value] () ] ]
- in
- let either a b = if a <> "" then a else b in
+ let article_form =
+ let input_set title input = p [ label [ pcdata title; input ] ] in
+ let either a b = if a <> "" then a else b in
+ let open Ymd in
+ let auth_name = either ymd.meta.author.Author.name Logarion.Configuration.(lgrn.owner) in
+ let auth_addr = either ymd.meta.author.Author.email Logarion.Configuration.(lgrn.email) in
+ [
+ input_set
+ "Title"
+ (input ~a:[a_name "title"; a_value ymd.meta.title] ());
+ input_set
+ "Author name"
+ (input ~a:[a_name "name"; a_value auth_name] ());
+ input_set
+ "Author email"
+ (input ~a:[a_name "email"; a_value auth_addr] ());
+ input_set
+ "Topics"
+ (input ~a:[a_name "topics"; a_value (String.concat ", " ymd.meta.topics)] ());
+ input_set
+ "Categories"
+ (input ~a:[a_name "categories"; a_value (String.concat ", " ymd.meta.categories)] ());
+ input_set
+ "Keywords"
+ (input ~a:[a_name "keywords"; a_value (String.concat ", " ymd.meta.keywords)] ());
+ input_set
+ "Series"
+ (input ~a:[a_name "series"; a_value (String.concat ", " ymd.meta.series)] ());
+ input_set
+ "Abstract"
+ (input ~a:[a_name "abstract"; a_value ymd.meta.abstract] ());
+ input_set
+ "Text"
+ (textarea ~a:[a_name "body"] (pcdata ymd.body));
+ p [ button ~a:[a_button_type `Submit] [pcdata "Submit"] ];
+ ] in
logarion_page
~header_tpl
blog_url
"Compose" "Article composition"
- Ymd.(div [
- form
- ~a:[a_method `Post; a_action (uri_of_string "/post"); a_accept_charset ["utf-8"];]
- [
- fieldset
- ~legend:(legend [pcdata "Article"])
- [
- input_set "Title" "title" ymd.meta.title;
- input_set "Author name" "name"
- (either ymd.meta.author.Author.name Logarion.Configuration.(lgrn.owner));
- input_set "Author email" "email"
- (either ymd.meta.author.Author.email Logarion.Configuration.(lgrn.email));
- input_set "Topics" "topics" (String.concat ", " ymd.meta.topics);
- input_set "Categories" "categories" (String.concat ", " ymd.meta.categories);
- input_set "Keywords" "keywords" (String.concat ", " ymd.meta.keywords);
- input_set "Series" "series" (String.concat ", " ymd.meta.series);
- input_set "Abstract" "abstract" ymd.meta.abstract;
- p [
- label [
- span [pcdata"Text"];
- textarea ~a:[a_name "body"] (pcdata ymd.body);
- ];
- ];
- p [ button ~a:[a_button_type `Submit] [pcdata "Submit"] ];
- ]
- ]
- ])
+ (div [ form
+ ~a:[a_method `Post; a_action (uri_of_string "/post"); a_accept_charset ["utf-8"];]
+ [ fieldset ~legend:(legend [pcdata "Article"]) article_form ]
+ ])
|> to_string