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:
fox
2022-11-01 17:11:09 +00:00
parent 0021ae508f
commit a89196679a
5 changed files with 34 additions and 25 deletions

View File

@@ -39,8 +39,7 @@ let directory converters noindex repo =
Printf.printf "Converted: %d Indexed: %d\n" count (List.length texts)
let load_kv dir =
let conf = Filename.concat dir ".convert.conf" in (* TODO: better name? *)
let kv = if Sys.file_exists conf then File_store.of_kv_file conf else Store.KV.empty in
let kv = File_store.of_kv_file () in
let idx = Filename.concat dir "index.pck" in
if not (Sys.file_exists idx) then kv else
match Header_pack.of_string @@ File_store.to_string (idx) with
@@ -48,7 +47,7 @@ let load_kv dir =
| Ok { info; peers; _ } ->
let kv = if Store.KV.mem "Id" kv then kv else Store.KV.add "Id" info.Header_pack.id kv in
let kv = if Store.KV.mem "Title" kv then kv else Store.KV.add "Title" info.Header_pack.title kv in
let kv = Store.KV.add "Locations" (String.concat ";\n" info.Header_pack.locations) kv in
let kv = if Store.KV.mem "Locations" kv then kv else Store.KV.add "Locations" (String.concat ";\n" info.Header_pack.locations) kv in
let kv = Store.KV.add "Peers" (String.concat ";\n" Header_pack.(to_str_list peers)) kv in
kv