Changeset 19 in code for trunk/cli/html.ml
- Timestamp:
- Oct 26, 2022, 7:36:02 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cli/html.ml
r18 r19 15 15 { templates = { header; footer} } 16 16 17 let wrap c htm text_title body =18 let site_title = try Logarion.Store.KV.find "Title" c .Conversion.kv17 let wrap conv htm text_title body = 18 let site_title = try Logarion.Store.KV.find "Title" conv.Conversion.kv 19 19 with Not_found -> "" in 20 20 let replace x = let open Str in … … 58 58 let keywords = str_set "keywords" text in 59 59 let header = 60 let time x = {|<time datetime="|} ^ x ^ {|">|} ^ x ^ "</time>" in 60 let time x = Printf.sprintf {|<time datetime="%s">%s</time>|} 61 (Date.rfc_string x) (Date.pretty_date x) in 61 62 let topic_links x = 62 63 let to_linked t a = … … 67 68 ^ opt_kv "Title:" text.title 68 69 ^ opt_kv "Authors:" authors 69 ^ opt_kv "Date: " (time (Date. (pretty_date @@ listing text.date)))70 ^ opt_kv "Date: " (time (Date.listing text.date)) 70 71 ^ opt_kv "Series: " (str_set "series" text) 71 72 ^ opt_kv "Topics: " (topic_links (set "topics" text)) … … 162 163 ^ listing_index topic_map [topic_root] "" metas) 163 164 164 open Logarion165 165 let indices htm c = 166 166 let file name = Logarion.File_store.file (Filename.concat c.Conversion.dir name) in 167 let index_name = try Store.KV.find "HTM-index" c.Conversion.kv with Not_found -> "index.html" in 168 let title = try Store.KV.find "Title" c.Conversion.kv with Not_found -> "" in 169 170 if index_name <> "" then 171 file index_name (topic_main_index c htm c.topic_roots c.texts); 172 167 let index_name = try Logarion.Store.KV.find "HTM-index" c.Conversion.kv with Not_found -> "index.html" in 168 if index_name <> "" then file index_name (topic_main_index c htm c.topic_roots c.texts); 173 169 file "index.date.htm" (date_index c htm c.texts); 174 175 170 List.iter 176 171 (fun root -> file ("index." ^ root ^ ".htm") (topic_sub_index c htm c.topics root c.texts)) 177 c.topic_roots ;172 c.topic_roots 178 173 179 let base_url = try 180 let locs = Store.KV.find "Locations" c.kv in 181 let _i = Str.(search_forward (regexp "https?://[^;]*") locs 0) in 182 Str.(matched_string locs) 183 with Not_found -> prerr_endline "Missing location for HTTP(S)"; "" in 184 file "feed.atom" (Atom.feed title c.id base_url "text/html" c.texts) 174 let converter kv = 175 let htm = init kv in 176 Conversion.{ ext; page = Some (page htm); indices = Some (indices htm) }
Note:
See TracChangeset
for help on using the changeset viewer.