Bug 121842 - Hyperlinks in user-defined index does not work
Summary: Hyperlinks in user-defined index does not work
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1.3.2 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: target:7.2.0
Keywords:
Depends on:
Blocks: TableofContents-Indexes
  Show dependency treegraph
 
Reported: 2018-12-01 14:30 UTC by Regina Henschel
Modified: 2021-02-05 10:43 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot (12.13 KB, image/png)
2021-02-02 23:28 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2018-12-01 14:30:51 UTC
The "Structure"-field in a user-defined index allows to set hyperlink-start(LS) and hyperlink-end (LE). But they do not generate a hyperlink.

The feature request for hyperlinks is in bug 71385.

This bug report is about the fact, that the UI gives an option, which does not really exists.
Comment 1 Gerhard Weydt 2018-12-19 17:49:37 UTC
This bug applies to a user-defined index in the strict sense, using index marks, but it works for a user-defined table of contents.
So it seems only one step to solve bug #71385 has been done but the rest is still missing.
I can reproduce it too in
Version: 6.2.0.0.alpha0+ (x64)
Build ID: 89a60912bba7ffd6f65ea99f4664f343c5025c95
CPU threads: 4; OS: Windows 10.0; UI render: GL; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2018-10-01_03:18:33
Locale: de-DE (de_DE); Calc: threaded
Comment 2 Michael Stahl (allotropia) 2019-01-08 10:13:49 UTC
IIRC Caolan added hyperlinks to some index or other?
Comment 3 Xisco Faulí 2019-01-16 22:45:50 UTC
I guess we can use the same version as bug 71385
Comment 4 Regina Henschel 2020-05-30 20:25:14 UTC
The hyperlinks work in Table of Figures, Index of Tables and Table of Objects in addition to TOC in LO 7.0, but still not in User-Defined index. To be clear, the link marks are in the entries and are preserved in save and reload, but they do not work as links. That is different from bug 71385, where hyperlinks neither exist in LO nor in ODF 1.3.
Comment 5 Michael Stahl (allotropia) 2021-01-27 15:33:44 UTC
hyperlinks work in User-Defined Index already, if you configure your index to be created from paragraph styles.

what doesn't work is hyperlinks to ToXMarks, this doesn't work in Table of Contents either.
Comment 6 Commit Notification 2021-02-02 17:17:10 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7685c0746cf0db6f51c6a7a488f4a960f8eab3c9

tdf#121842 sw: add hyperlinks to toxmarks in ToC/User-Defined Index

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Michael Stahl (allotropia) 2021-02-02 17:19:02 UTC
fixed on master
Comment 8 Regina Henschel 2021-02-02 23:28:06 UTC
Created attachment 169410 [details]
Screenshot

The hyperlink works, but the tooltip looks strange, see attached screenshot.
Comment 9 Michael Stahl (allotropia) 2021-02-03 14:06:18 UTC
working as designed :) thanks for testing

(it would be possible in theory not to url-encode the %7C but there's no URI::encode flag for that effect...)
Comment 10 Regina Henschel 2021-02-03 15:13:19 UTC
If you make an index for tables, the ! and the | are not url-encoded, neither in the tooltip of the index nor in the tooltip in 'Hyperlinks' section in Navigator. I would expect the same behavior here.
Comment 11 Michael Stahl (allotropia) 2021-02-03 18:16:13 UTC
yes that's true, but the problem is

"|" isn't encoded because rtl::Uri::encode implements an outdated RFC 2732 that allows "[", "]" but the current RFC 3986 requires encoding them, so we can't use rtl_UriCharClassUric

"!" isn't usable as a separator because both the text of the toxmark and the name of the user-defined index are unrestricted strings so we have to use some character that can't be used in those strings which leaves only control characters basically
Comment 12 Michael Stahl (allotropia) 2021-02-03 18:17:40 UTC
oh i forgot, the other problem is: it's possible that some of the existing strings that go into fragments are unrestricted as well and may contain characters requiring encoding, it's a bug that that isn't done in those cases
Comment 13 Michael Stahl (allotropia) 2021-02-03 18:27:37 UTC
sorry, i mis-remembered: the "|" is not actually allowed anywhere in a URI in RFC3986 and probably not in the earlier RFCs either.

the existing links being generated there are all buggy, they have to be encoded.
Comment 14 Regina Henschel 2021-02-03 21:32:21 UTC
Oh I see. Then the href-value, that is produced by the Index of Tables is currently invalid. I've seen you have already written a patch in regard to encoding.

But as the encoding is necessary to generate valid URLs, a new enhancement request is needed, to change the generation of the tooltips so, that there the URL is decoded to be better human readable.
Comment 15 Commit Notification 2021-02-05 10:43:00 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7f14ea4431cb4182bccbd9998a60db2f9d9ae07a

(related: tdf#121842) sw: encode URLs generated in ToX

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.