- Timestamp:
- Nov 1, 2022, 5:11:09 PM (2 years ago)
- Location:
- trunk/cli
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cli/convert.ml
r20 r21 40 40 41 41 let load_kv dir = 42 let conf = Filename.concat dir ".convert.conf" in (* TODO: better name? *) 43 let kv = if Sys.file_exists conf then File_store.of_kv_file conf else Store.KV.empty in 42 let kv = File_store.of_kv_file () in 44 43 let idx = Filename.concat dir "index.pck" in 45 44 if not (Sys.file_exists idx) then kv else … … 49 48 let kv = if Store.KV.mem "Id" kv then kv else Store.KV.add "Id" info.Header_pack.id kv in 50 49 let kv = if Store.KV.mem "Title" kv then kv else Store.KV.add "Title" info.Header_pack.title kv in 51 let kv = Store.KV.add "Locations" (String.concat ";\n" info.Header_pack.locations) kv in50 let kv = if Store.KV.mem "Locations" kv then kv else Store.KV.add "Locations" (String.concat ";\n" info.Header_pack.locations) kv in 52 51 let kv = Store.KV.add "Peers" (String.concat ";\n" Header_pack.(to_str_list peers)) kv in 53 52 kv -
trunk/cli/html.ml
r20 r21 28 28 let header = match htm.templates.header with 29 29 | Some x -> replace x 30 | None -> Printf.(sprintf "<header><a href='.'>%s</a> </header>%s" site_title30 | None -> Printf.(sprintf "<header><a href='.'>%s</a>%s</header>" site_title 31 31 (if feed <> "" then sprintf "<nav><a href='%s' id='feed'>feed</a></nav>" feed else "")) 32 32 in -
trunk/cli/publish.ml
r13 r21 1 1 let targets () = 2 let home = 3 try Sys.getenv "txtpubdir" with Not_found -> 4 try Sys.getenv "HOME" with Not_found -> "" 2 let kv = Logarion.File_store.of_kv_file () in 3 let pub_dir = 4 try Logarion.Store.KV.find "Pubdir" kv with Not_found -> 5 try Sys.getenv "txtpubdir" with Not_found -> "" 5 6 in 6 List.filter 7 (fun x -> try Sys.is_directory (snd x) with Sys_error _ -> false) 8 [ 9 "htm", home ^ "/public_html/txt"; 10 "gmi", home ^ "/public_gemini/txt"; 11 "", home ^ "/public_gopher/txt"; 12 ] 7 let exists_dir dir = Sys.is_directory (Filename.concat pub_dir dir) in 8 List.filter (fun x -> try exists_dir (snd x) with Sys_error _ -> false) [ 9 "htm,atom", "public_html/"; 10 "gmi,gmi-atom", "public_gemini/"; 11 "", "public_gopher/"; 12 ] 13 13 14 14 open Logarion … … 17 17 let targets = targets () in 18 18 let pub_dirs = List.map (fun x -> snd x) targets in 19 try File_store.iter ~predicate (fun (_t, p) -> File.file ((List.hd p)::pub_dirs)) 20 with Unix.Unix_error (Unix.EEXIST, _, _) -> (); 21 List.iter (fun t -> 19 File_store.iter ~predicate (fun (_t, p) -> 20 try File.file ((List.hd p)::pub_dirs) 21 with Unix.Unix_error (Unix.EEXIST, _, _) -> ()); 22 List.iter (fun t -> Printf.eprintf "%s %s\n" (fst t) (snd t); 22 23 Index.((load (snd t)) false None None None None); 23 Convert.at_path (fst t) false (snd t)) 24 Convert.at_path (fst t) false (snd t); 25 prerr_endline (snd t)) 24 26 targets 25 27
Note:
See TracChangeset
for help on using the changeset viewer.