[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * js/info.css (cache_index_links): Fix index entr
From: |
Per Bothner |
Subject: |
branch master updated: * js/info.css (cache_index_links): Fix index entry processing. |
Date: |
Tue, 29 Nov 2022 17:39:00 -0500 |
This is an automated email from the git hooks/post-receive script.
bothner pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new a090d1644c * js/info.css (cache_index_links): Fix index entry
processing.
a090d1644c is described below
commit a090d1644c0d33994b1992e682adcec74853b10c
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 66547938a6..11ad5fa68a 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 bf555bcf9d..b348629c85 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-section 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 ();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * js/info.css (cache_index_links): Fix index entry processing.,
Per Bothner <=