diff --git a/cli/html.ml b/cli/html.ml index 880dbbe..46d31be 100644 --- a/cli/html.ml +++ b/cli/html.ml @@ -83,9 +83,9 @@ let to_dated_links ?(limit) meta_list = List.rev @@ reduced [] 0 meta_list in List.fold_left - (fun a m -> - a ^ Logarion.(Date.(pretty_date (listing m.Text.date)) ^ " ") - ^ {||} ^ m.Logarion.Text.title ^ "
") + (fun a m -> Printf.sprintf "%s
  • %s %s" a + Logarion.(Date.(pretty_date (listing m.Text.date))) + (Logarion.Text.short_id m) m.Logarion.Text.title) "" meta_list let date_index ?(limit) conv htm meta_list = @@ -146,8 +146,8 @@ let listing_index topic_map topic_roots path metas = let topic_main_index conv htm topic_roots metas = wrap conv htm "Topics" (fold_topic_roots topic_roots - ^ "|} ) + ^ "|} ) let topic_sub_index conv htm topic_map topic_root metas = wrap conv htm topic_root diff --git a/lib/date.ml b/lib/date.ml index da07617..098a813 100644 --- a/lib/date.ml +++ b/lib/date.ml @@ -3,9 +3,12 @@ let compare = compare let rfc_string date = date let of_string (rfc : string) = rfc let listing date = if date.edited <> "" then date.edited else date.created +let months = [|"Jan";"Feb";"Mar";"Apr";"May";"Jun";"Jul";"Aug";"Sep";"Oct";"Nov";"Dec"|] let pretty_date date = - try Scanf.sscanf date "%4s-%2s-%2s" (fun y m d -> Printf.sprintf "%s %s %s" y m d) - with Scanf.Scan_failure s as e -> Printf.fprintf stderr "%s for %s\n" s date; raise e + try Scanf.sscanf date "%4s-%d-%2s" (fun y m d -> Printf.sprintf "%s %s, %s" d (months.(m-1)) y) + with + | Scanf.Scan_failure s as e -> Printf.fprintf stderr "%s for %s\n" s date; raise e + | Invalid_argument _s as e -> Printf.fprintf stderr "Parsing %s" date; raise e let now () = Unix.time () |> Unix.gmtime |> (fun t -> Printf.sprintf "%4d-%02d-%02dT%02d:%02d:%02dZ" (t.tm_year+1900) (t.tm_mon+1) t.tm_mday t.tm_hour t.tm_min t.tm_sec)