Changeset 5 in code
- Timestamp:
- Jun 13, 2022, 4:34:20 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cli/html.ml
r3 r5 84 84 in 85 85 List.fold_left 86 (fun a m -> 87 a ^ Logarion.(Date.(pretty_date (listing m.Text.date)) ^ " ")88 ^ {|<a href="|} ^ Logarion.Text.short_id m ^ {|.htm">|} ^ m.Logarion.Text.title ^ "</a><br>")86 (fun a m -> Printf.sprintf "%s<li> %s <a href=\"%s.htm\">%s</a>" a 87 Logarion.(Date.(pretty_date (listing m.Text.date))) 88 (Logarion.Text.short_id m) m.Logarion.Text.title) 89 89 "" meta_list 90 90 … … 147 147 wrap conv htm "Topics" 148 148 (fold_topic_roots topic_roots 149 ^ "<nav><h1>Latest</h1> " ^ to_dated_links ~limit:10metas150 ^ {|< a href="index.date.htm">More by date</a></nav>|} )149 ^ "<nav><h1>Latest</h1><ul>" ^ to_dated_links ~limit:8 metas 150 ^ {|</ul><a href="index.date.htm">More by date</a></nav>|} ) 151 151 152 152 let topic_sub_index conv htm topic_map topic_root metas = -
trunk/lib/date.ml
r3 r5 4 4 let of_string (rfc : string) = rfc 5 5 let listing date = if date.edited <> "" then date.edited else date.created 6 let months = [|"Jan";"Feb";"Mar";"Apr";"May";"Jun";"Jul";"Aug";"Sep";"Oct";"Nov";"Dec"|] 6 7 let pretty_date date = 7 try Scanf.sscanf date "%4s-%2s-%2s" (fun y m d -> Printf.sprintf "%s %s %s" y m d) 8 with Scanf.Scan_failure s as e -> Printf.fprintf stderr "%s for %s\n" s date; raise e 8 try Scanf.sscanf date "%4s-%d-%2s" (fun y m d -> Printf.sprintf "%s %s, %s" d (months.(m-1)) y) 9 with 10 | Scanf.Scan_failure s as e -> Printf.fprintf stderr "%s for %s\n" s date; raise e 11 | Invalid_argument _s as e -> Printf.fprintf stderr "Parsing %s" date; raise e 9 12 let now () = Unix.time () |> Unix.gmtime |> 10 13 (fun t -> Printf.sprintf "%4d-%02d-%02dT%02d:%02d:%02dZ"
Note:
See TracChangeset
for help on using the changeset viewer.