From 962d11f92bf02c90b00aab7c5100f8ea30a7711c Mon Sep 17 00:00:00 2001 From: "yakumo.izuru" Date: Tue, 13 Feb 2024 23:23:38 +0000 Subject: [PATCH] Reverse all the HTML changes, add a generator meta tag, and a To-do Signed-off-by: Izuru Yakumo git-svn-id: file:///srv/svn/repo/kosuzu/trunk@59 eb64cd80-c68d-6f47-b6a3-0ada418499da --- TODO.md | 3 +++ cli/html.ml | 34 +++++++++++++++++----------------- 2 files changed, 20 insertions(+), 17 deletions(-) create mode 100644 TODO.md diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..f289c40 --- /dev/null +++ b/TODO.md @@ -0,0 +1,3 @@ +# To-do +* Support [geomyidae](gopher://bitreich.org/1/scm/geomyidae) `.gph` indexes, for now those can be generated manually somewhat +* Support tab-separated value gophermaps for any other gopher daemon diff --git a/cli/html.ml b/cli/html.ml index d88ab25..1692771 100644 --- a/cli/html.ml +++ b/cli/html.ml @@ -31,8 +31,8 @@ let wrap conv htm text_title body = (if feed <> "" then sprintf "feed" feed else "")) in let footer = match htm.templates.footer with None -> "" | Some x -> replace x in - Printf.sprintf "\n\n\n\n%s%s\n%s\n%s\n\n\n\n\n%s%s%s\n" - text_title (if site_title <> "" then (" • " ^ site_title) else "") + Printf.sprintf "\n\n\n\n%s%s\n%s\n%s\n\n\n\n\n\n%s%s%s\n" + text_title (if site_title <> "" then (" • " ^ site_title) else "") htm.style (if feed <> "" then Printf.sprintf "" feed else "") header body footer @@ -59,7 +59,7 @@ let page htm conversion text = then "
" ^ key ^ "
" ^ value else "" in let authors = Person.Set.to_string text.authors in let header = - let time x = Printf.sprintf {|%s|} + let time x = Printf.sprintf {||} (Date.rfc_string x) (Date.pretty_date x) in let topic_links x = let to_linked t a = @@ -72,7 +72,7 @@ let page htm conversion text = let references, replies = let open Conversion in let Rel.{ref_set; rep_set; _} = try Rel.Id_map.find text.id conversion.relations with Not_found -> Rel.empty in ref_links ref_set, ref_links rep_set in - "
" + "
" ^ opt_kv "Title:" text.title ^ opt_kv "Authors:" authors ^ opt_kv "Date:" (time (Date.listing text.date)) @@ -83,8 +83,8 @@ let page htm conversion text = ^ opt_kv "In reply to:" (ref_links (set "in-reply-to" text)) ^ opt_kv "Referred by:" references ^ opt_kv "Replies:" replies - ^ {|
|} in
-        wrap conversion htm text.title ((T.of_string text.body header) ^ "
") + ^ {|
|} in
+        wrap conversion htm text.title ((T.of_string text.body header) ^ "
") let to_dated_links ?(limit) meta_list = let meta_list = match limit with @@ -95,7 +95,7 @@ let to_dated_links ?(limit) meta_list = | h::t -> if i < limit then reduced (h::acc) (i+1) t else acc in List.rev @@ reduced [] 0 meta_list in List.fold_left - (fun a m -> Printf.sprintf "%s
  • %s %s
  • " a Logarion.(Date.(pretty_date (listing m.Text.date))) + (fun a m -> Printf.sprintf "%s
  • %s %s" a Logarion.(Date.(pretty_date (listing m.Text.date))) (Logarion.Text.short_id m) m.Logarion.Text.title) "" meta_list @@ -106,9 +106,9 @@ let date_index ?(limit) conv htm meta_list = let fold_topic_roots topic_roots = let list_item root t = "
  • " ^ topic_link root t in - "

    Main topics

    " + "" let fold_topics topic_map topic_roots metas = let open Logarion in @@ -123,15 +123,15 @@ and list_item root t = if List.exists (fun x -> String_set.mem t (String_set.map Topic_set.topic (Text.set "topics" x))) metas then topic_link root t else String.capitalize_ascii t in "
    • " ^ item ^ sub_items root t ^ "
    " in - "

    Topics

    " + "" let text_item path meta = let open Logarion in - "

    " ^ Date.(pretty_date (listing meta.Text.date)) - ^ {||} ^ meta.Text.title - ^ "


    " + " |} ^ meta.Text.title + ^ "
    " let listing_index topic_map topic_roots path metas = let rec item_group topics = @@ -149,13 +149,13 @@ and items topic = match items with | "" -> "" | x -> {|

    |} ^ String.capitalize_ascii topic ^ "

    " ^ x in - "

    Texts

    " ^ item_group topic_roots ^ "" + "" let topic_main_index conv htm topic_roots metas = wrap conv htm "Topics" (fold_topic_roots topic_roots - ^ "

    Latest

      " ^ to_dated_links ~limit:10 metas - ^ {|

      More by date

      |} + ^ "
      More by date|} ^ let peers = try Logarion.Store.KV.find "Peers" conv.kv with Not_found -> "" in (if peers = "" then "" else List.fold_left (fun a s -> Printf.sprintf {|%s
    • %s|} a s s) "

      Peers

        "