Moved conversion file, conf -> pack, fixes
Conversion:
- Configuration sought in: txt.conf, ~/.config/txt/txt.conf
- logarion.conf to produce index and target formats
Publication:
- `publish <ids>`: copies txt with ID into Pubdir/public_{html,gemini,gopher} (Pubdir fromtxt.conf), if dirs exist, and runs `convert <pubdir>`
Fixes:
- Feed <nav> regression
git-svn-id: file:///srv/svn/repo/kosuzu/trunk@21 eb64cd80-c68d-6f47-b6a3-0ada418499da
This commit is contained in:
@@ -1,26 +1,28 @@
|
||||
let targets () =
|
||||
let home =
|
||||
try Sys.getenv "txtpubdir" with Not_found ->
|
||||
try Sys.getenv "HOME" with Not_found -> ""
|
||||
let kv = Logarion.File_store.of_kv_file () in
|
||||
let pub_dir =
|
||||
try Logarion.Store.KV.find "Pubdir" kv with Not_found ->
|
||||
try Sys.getenv "txtpubdir" with Not_found -> ""
|
||||
in
|
||||
List.filter
|
||||
(fun x -> try Sys.is_directory (snd x) with Sys_error _ -> false)
|
||||
[
|
||||
"htm", home ^ "/public_html/txt";
|
||||
"gmi", home ^ "/public_gemini/txt";
|
||||
"", home ^ "/public_gopher/txt";
|
||||
]
|
||||
let exists_dir dir = Sys.is_directory (Filename.concat pub_dir dir) in
|
||||
List.filter (fun x -> try exists_dir (snd x) with Sys_error _ -> false) [
|
||||
"htm,atom", "public_html/";
|
||||
"gmi,gmi-atom", "public_gemini/";
|
||||
"", "public_gopher/";
|
||||
]
|
||||
|
||||
open Logarion
|
||||
let publish ids =
|
||||
let predicate t = List.mem t.Text.id ids in
|
||||
let targets = targets () in
|
||||
let pub_dirs = List.map (fun x -> snd x) targets in
|
||||
try File_store.iter ~predicate (fun (_t, p) -> File.file ((List.hd p)::pub_dirs))
|
||||
with Unix.Unix_error (Unix.EEXIST, _, _) -> ();
|
||||
List.iter (fun t ->
|
||||
File_store.iter ~predicate (fun (_t, p) ->
|
||||
try File.file ((List.hd p)::pub_dirs)
|
||||
with Unix.Unix_error (Unix.EEXIST, _, _) -> ());
|
||||
List.iter (fun t -> Printf.eprintf "%s %s\n" (fst t) (snd t);
|
||||
Index.((load (snd t)) false None None None None);
|
||||
Convert.at_path (fst t) false (snd t))
|
||||
Convert.at_path (fst t) false (snd t);
|
||||
prerr_endline (snd t))
|
||||
targets
|
||||
|
||||
open Cmdliner
|
||||
|
||||
Reference in New Issue
Block a user