From 2c99521949120acdf7b9e1356ad48634ce7c661b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Loi=CC=88c=20Correnson?= <loic.correnson@cea.fr>
Date: Fri, 13 Dec 2019 15:44:00 +0100
Subject: [PATCH] [server] provide category in index title entries

---
 src/plugins/server/request.ml | 3 ++-
 src/plugins/server/syntax.ml  | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/plugins/server/request.ml b/src/plugins/server/request.ml
index 75b095985ab..62edd8ff9b6 100644
--- a/src/plugins/server/request.ml
+++ b/src/plugins/server/request.ml
@@ -296,6 +296,7 @@ let register_sig (type a b) (s : (a,b) signature) (process : rq -> a -> b) =
   in
   let skind = Main.string_of_kind s.kind in
   let title =  Printf.sprintf "`%s` %s" skind s.name in
+  let index = [ Printf.sprintf "%s (`%s`)" s.name skind ] in
   let header = [ plain "Input", Center; plain "Output", Center] in
   let content =
     [[ Syntax.text @@ sy_input s.input ;
@@ -308,7 +309,7 @@ let register_sig (type a b) (s : (a,b) signature) (process : rq -> a -> b) =
     doc_output s.output
   in
   let _ =
-    Doc.publish ~page:s.page ~name:s.name ~title ~index:[s.name] description []
+    Doc.publish ~page:s.page ~name:s.name ~title ~index description []
   in
   Main.register s.kind s.name processor ;
   s.defined <- true
diff --git a/src/plugins/server/syntax.ml b/src/plugins/server/syntax.ml
index f36e96261b9..4b47e47ba69 100644
--- a/src/plugins/server/syntax.ml
+++ b/src/plugins/server/syntax.ml
@@ -65,12 +65,13 @@ let publish ~page ~name ~descr ~synopsis ?(details = []) () =
   check_page page name ;
   let id = Printf.sprintf "data-%s" name in
   let title = Printf.sprintf "`DATA` %s" name in
-  let dref = Doc.href page id in
+  let index = [ Printf.sprintf "%s (`DATA`)" name ] in
+    let dref = Doc.href page id in
   let dlink = Markdown.href ~text:(Markdown.emph name) dref in
   let syntax = Markdown.(glue [
       plain "<" ; dlink ; plain ">" ; plain ":=" ; synopsis.text ]) in
   let content = Markdown.(Block ( text descr @ text syntax ) :: details) in
-  let _href = Doc.publish ~page ~name:id ~title ~index:[name] content [] in
+  let _href = Doc.publish ~page ~name:id ~title ~index content [] in
   atom dlink
 
 let unit = atom @@ Markdown.plain "-"
-- 
GitLab