bug-texinfo
[Top][All Lists]
Advanced

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

link handling in js-reader


From: Per Bothner
Subject: link handling in js-reader
Date: Wed, 3 Mar 2021 08:09:01 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0

The JavaScript info reader calls the fix_links function to convert
cross-references to special "magic" links that load a different page
(or scroll within the current one). "External" references are unchanged,
except the 'target' attribute is set so they open in a new tab.

This logic is rather broken in the case of relative URLs.  You can see
one place where a link is treated as internal but should be treated as external:
https://per.bothner.com/tmp/DomTerm-txjs-plain/index.html
Click on the first image.

Ideally, one could determine which links are internal by checking for an
entry in the table-of-contents.  However, that is bit complicated,
mainly because sub-pages don't have access to the ToC, so it would
have to involve message sending between JavaScript contexts (no big deal).

Alternatively, we can have makeinfo mark external and internal references
differently, perhaps by setting a 'target' attribute for @uref.

Or we can use better heuristics: Only treat as internal references ones
that are in the same directory (no '/' in the URL) *and* whose
extension is either '.html' or '.xhtml' (for future xhtml/epub support)
- e.g.. images are "external".  Or maybe require the file extension in
the link to match that of the current page for it to be considered internal.

I'm leaning towards the latter approach, which would only
require a modest change to fix_links.

Comments?
--
        --Per Bothner
per@bothner.com   http://per.bothner.com/



reply via email to

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