texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]


From: Gavin D. Smith
Date: Wed, 30 Nov 2022 07:10:38 -0500 (EST)

branch: release/7.0
commit 159bceeec64c686ab517557853002a3e68072960
Author: Per Bothner <per@bothner.com>
AuthorDate: Tue Nov 29 14:38:33 2022 -0800

    * js/info.css (cache_index_links): Fix index entry processing.
    
    Also implement subentry handling.
    (init_iframe - on_load): Change search and call of cache_index_links.
---
 ChangeLog  |  6 ++++++
 js/info.js | 30 ++++++++++++++++++++++++++----
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6d08cb65a9..f7d716fbb8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-11-29  Per Bothner  <per@bothner.com>
+
+       * js/info.css (cache_index_links): Fix index entry processing.
+       Also implement subentry handling.
+       (init_iframe - on_load): Change search and call of cache_index_links.
+
 2022-11-29  Per Bothner  <per@bothner.com>
 
        * js/info.css (.tex-input): Make input element a bit wider.
diff --git a/js/info.js b/js/info.js
index a43b1fd068..97c6ce3839 100644
--- a/js/info.js
+++ b/js/info.js
@@ -146,10 +146,32 @@
     /** @arg {NodeListOf<Element>} links */
     cache_index_links: function (links) {
       var dict = {};
+      var text0 = "", text1 = ""; // for subentries
       for (var i = 0; i < links.length; i += 1)
         {
           var link = links[i];
-          dict[link.textContent] = href_hash (link_href (link));
+          var link_cl = link.classList;
+          var text = link.textContent;
+          if (link_cl.contains("index-entry-level-2"))
+            {
+                text = text0 + "; " + text1 + "; " + text;
+            }
+          else if (link_cl.contains("index-entry-level-1"))
+            {
+              text1 = text;
+                text = text0 + "; " + text;
+            }
+          else
+            {
+              text0 = text;
+            }
+
+          if ((link = link.nextSibling)
+              && link.classList.contains("printindex-index-section")
+              && (link = link.firstChild))
+            {
+              dict[text] = href_hash (link_href (link));
+            }
         }
       return { type: "cache-index-links", links: dict };
     },
@@ -1457,9 +1479,9 @@
       if (linkid_contains_index (linkid))
         {
           /* Scan links that should be added to the index.  */
-          var index_links = document.querySelectorAll
-            ("td.printindex-index-entry a");
-          store.dispatch (actions.cache_index_links (index_links));
+          var index_entries = document.querySelectorAll
+            ("td.printindex-index-entry");
+          store.dispatch (actions.cache_index_links (index_entries));
         }
 
       add_icons ();



reply via email to

[Prev in Thread] Current Thread [Next in Thread]