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
[email protected]   http://per.bothner.com/

Reply via email to