I can confirm the problem with the JavaScript. I was able to rewrite the
code to get the desired behavior with the index entires, but sure enough,
after the change searching the index this way would reopen the sidebar if
it had been collapsed.

Personally, I'd much rather have the index entries work as expected and the
sidebar reopen than have the index entries point to the top of the node and
have the sidebar stay closed, but I'll poke around and see if I can figure
out why the sidebar is opening and if there is a way to change that without
modifying the index behavior.

Benjamin Kalish

On Fri, Sep 20, 2024 at 3:52 PM Gavin Smith <gavinsmith0...@gmail.com>
wrote:

> On Thu, Sep 19, 2024 at 03:38:12PM -0400, Benjamin Kalish wrote:
> > Two related but distinct questions:
> >
> > 1. How can I change the index output to contain only the first column
> > (index entry names linking to to the points on the page where the index
> > entries occurs) and excluding the second column (node names linking to
> the
> > top of the nodes).
>
> There doesn't appear to be any way to achieve this in the code.
>
> You can hide the second column using CSS:
>
> $ cat test.texi
> \input texinfo
>
> @node Top
> @top
>
> @cindex aaa
>
>
> @printindex cp
>
>
> @bye
>
> $ cat extra.css
> th.sections-header-printindex { visibility: hidden }
> td.printindex-index-section { visibility: hidden }
>
> $ texi2any test.texi --html --no-split --css-include=extra.css
>
> (texi2any 7.1.1.)
>
> >
> > 2. How can I change the behavior of the JavaScript index search so that
> it
> > uses the links to the point on the page where an index entry occurs
> instead
> > of linking to the top of the node?
> >
> >
> > (For #2 I am tempted to say this would be a preferable default behavior
> for
> > all projects.)
>
> I am sure it is supposed to do this already, but when I tested it it
> didn't.
> Unfortunately there is nobody who has time or interest to maintain
> this JavaScript code and I don't think there are any active developers who
> understand it very well.
>
> I've tried looking at the code but can't spot anything obvious.
>
> It may have been related to the fix discussed in this message:
>
> https://lists.gnu.org/archive/html/bug-texinfo/2022-11/msg00225.html
>
> From:   Per Bothner
> Subject:        Re: info.js demo on Texinfo manual updated on website
> Date:   Sun, 27 Nov 2022 16:40:02 -0800
> > The problem is we were using the query pattern
> "td.printindex-index-entry a"
> > which gives us URLS of the form
> > "Texinfo-File-Header.html#index-Beginning-line-of-a-Texinfo-file".
> > That loads the right page, but it doesn't match what is in the ToC, used
> to
> > generate the sidebar.
> >
> > Instead we need to use "td.printindex-index-section a" which gives us
> > URLs of the form "Texinfo-File-Header.html#First-Line".
>
> I can't remember if it worked at the time.  But now it's a bug that
> we'll have to fix.
>

Reply via email to