From 6cffca9721a4abb8408048c877cc097c8aa5ec97 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@uliege.be>
Date: Mon, 28 Sep 2020 15:19:07 +0200
Subject: [PATCH] insert discretionary hyphen if texinfo item is too long (so
 that the index stays clean)

---
 api/GenApi.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/api/GenApi.py b/api/GenApi.py
index 1b4db9fcca..fb1139a8fb 100644
--- a/api/GenApi.py
+++ b/api/GenApi.py
@@ -1658,7 +1658,13 @@ class API:
                     "\n\n")
             f.write("@ftable @code\n")
             for rtype, name, args, doc, special in module.fs:
-                f.write("@item " + path + '/' + name + "\n")
+                tfull = path + '/' + name
+                if len(tfull) > 40: # insert discretionary hyphen if too long
+                    for i in range(40, len(tfull)):
+                        if tfull[i].isupper():
+                            tfull = tfull[:i] + '@-' + tfull[i:]
+                            break
+                f.write("@item " + tfull + "\n")
                 tdoc = doc.replace("`", "@code{").replace("'", "}")
                 f.write("\n".join(textwrap.wrap(tdoc, 80)) + "\n\n")
                 f.write("@table @asis\n")
-- 
GitLab