Changeset 15 in code for trunk/cli/html.ml


Ignore:
Timestamp:
Sep 24, 2022, 8:01:37 PM (3 years ago)
Author:
fox
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cli/html.ml

    r5 r15  
    3737let topic_link root topic =
    3838  let replaced_space = String.map (function ' '->'+' | x->x) in
    39   "<a href='index." ^ replaced_space root ^ ".htm#" ^ replaced_space topic ^ "'>"
     39  "<a href='index." ^ root ^ ".htm#" ^ replaced_space topic ^ "'>"
    4040  ^ String.capitalize_ascii topic ^ "</a>"
    4141
     
    148148    (fold_topic_roots topic_roots
    149149     ^ "<nav><h1>Latest</h1><ul>" ^ to_dated_links ~limit:8 metas
    150      ^ {|</ul><a href="index.date.htm">More by date</a></nav>|} )
     150     ^ {|</ul><a href="index.date.htm">More by date</a>|}
     151     ^ let peers = Logarion.Store.KV.find "Peers" conv.kv in
     152       (if peers = "" then "" else
     153        List.fold_left (fun a s -> Printf.sprintf {|%s<li><a href="%s">%s</a>|} a s s) "<h1>Peers</h1><ul>"
     154        (Str.split (Str.regexp ";\n") (Logarion.Store.KV.find "Peers" conv.kv))
     155        ^ "</ul>"))
    151156
    152157let topic_sub_index conv htm topic_map topic_root metas =
     
    172177
    173178        let base_url = try
    174                 let _i = Str.(search_forward (regexp "https?://[^;]*") (Store.KV.find "Locations" c.kv) 0) in
    175                 Str.(matched_string (Store.KV.find "Locations" c.kv))
     179                let locs = Store.KV.find "Locations" c.kv in
     180                let _i = Str.(search_forward (regexp "https?://[^;]*") locs 0) in
     181                Str.(matched_string locs)
    176182                with Not_found -> prerr_endline "Missing location for HTTP(S)"; "" in
    177183        file "feed.atom" (Atom.feed title c.id base_url "text/html" c.texts)
Note: See TracChangeset for help on using the changeset viewer.