List peers (from index.pck) in exported htm and gmi index

git-svn-id: file:///srv/svn/repo/kosuzu/trunk@15 eb64cd80-c68d-6f47-b6a3-0ada418499da
This commit is contained in:
fox
2022-09-24 20:01:37 +00:00
parent 4f42df7037
commit ef29c97a92
5 changed files with 23 additions and 12 deletions

View File

@@ -36,7 +36,7 @@ let wrap c htm text_title body =
let topic_link root topic =
let replaced_space = String.map (function ' '->'+' | x->x) in
"<a href='index." ^ replaced_space root ^ ".htm#" ^ replaced_space topic ^ "'>"
"<a href='index." ^ root ^ ".htm#" ^ replaced_space topic ^ "'>"
^ String.capitalize_ascii topic ^ "</a>"
module HtmlConverter = struct
@@ -147,7 +147,12 @@ let topic_main_index conv htm topic_roots metas =
wrap conv htm "Topics"
(fold_topic_roots topic_roots
^ "<nav><h1>Latest</h1><ul>" ^ to_dated_links ~limit:8 metas
^ {|</ul><a href="index.date.htm">More by date</a></nav>|} )
^ {|</ul><a href="index.date.htm">More by date</a>|}
^ let peers = Logarion.Store.KV.find "Peers" conv.kv in
(if peers = "" then "" else
List.fold_left (fun a s -> Printf.sprintf {|%s<li><a href="%s">%s</a>|} a s s) "<h1>Peers</h1><ul>"
(Str.split (Str.regexp ";\n") (Logarion.Store.KV.find "Peers" conv.kv))
^ "</ul>"))
let topic_sub_index conv htm topic_map topic_root metas =
wrap conv htm topic_root
@@ -171,7 +176,8 @@ let indices htm c =
c.topic_roots;
let base_url = try
let _i = Str.(search_forward (regexp "https?://[^;]*") (Store.KV.find "Locations" c.kv) 0) in
Str.(matched_string (Store.KV.find "Locations" c.kv))
let locs = Store.KV.find "Locations" c.kv in
let _i = Str.(search_forward (regexp "https?://[^;]*") locs 0) in
Str.(matched_string locs)
with Not_found -> prerr_endline "Missing location for HTTP(S)"; "" in
file "feed.atom" (Atom.feed title c.id base_url "text/html" c.texts)