From 90ec1d244ca3299cc4b20698ccc42e1bc75b32ae Mon Sep 17 00:00:00 2001 From: orbifx Date: Tue, 22 Jun 2021 14:50:50 +0100 Subject: [PATCH] Gemini heading fixes --- cli/gemini.ml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/cli/gemini.ml b/cli/gemini.ml index 4bfa0d0..52bc2cc 100644 --- a/cli/gemini.ml +++ b/cli/gemini.ml @@ -33,7 +33,6 @@ let to_dated_links ?(limit) meta_list = let topic_link root topic = "=> index." ^ root ^ ".gmi " ^ String.capitalize_ascii topic ^ "\n" - let text_item path meta = let open Logarion in "=> " ^ path ^ Text.alias meta ^ ".gmi " @@ -59,17 +58,16 @@ let listing_index topic_map topic_roots path metas = in item_group topic_roots - let fold_topic_roots topic_roots = let list_item root t = topic_link root t in List.fold_left (fun a x -> a ^ list_item x x) "" (List.rev topic_roots) -let topic_main_index _title topic_roots metas = - "# Main topics\n\n" - ^ fold_topic_roots topic_roots - ^ "\n\n# Latest\n\n" ^ to_dated_links ~limit:10 metas +let topic_main_index title topic_roots metas = + "# " ^ title ^ "\n\n" + ^ if topic_roots <> [] then ("## Main topics\n\n" ^ fold_topic_roots topic_roots) else "" + ^ "\n## Latest\n\n" ^ to_dated_links ~limit:10 metas ^ "\n=> index.date.gmi More by date\n" -let topic_sub_index _title topic_map topic_root metas = - "# " ^ String.capitalize_ascii topic_root ^ "\n\n" +let topic_sub_index title topic_map topic_root metas = + "# " ^ title ^ "\n\n" ^ listing_index topic_map [topic_root] "" metas