Ticket #4144 (closed defect: fixed)
Opened 5 years ago
Last modified 5 years ago
Relative links in wiki change messages are still relative when displayed elsewhere
| Reported by: | Tim Hatch <trac@…> | Owned by: | cboos |
|---|---|---|---|
| Priority: | low | Milestone: | 0.11 |
| Component: | wiki system | Version: | devel |
| Severity: | minor | Keywords: | context |
| Cc: | |||
| Release Notes: | |||
| API Changes: | |||
Description
If you save a wiki change with a message something like Edited [#sec-1 Section 1], it still shows up as a link on both the wiki page's log and the timeline -- both places the link is still considered relative to the "current page" where it would more correctly be relative to the wiki page that was edited (current revision, I suppose). This currently appears on http://trac.edgewall.org/wiki/TracSubversion?action=diff&version=34 and I verified it on trunk.
Another option is to disable relative links when being shown out-of-context, as the comment:n traclink for ticket comments does.
I'm attaching a first-draft fix for timeline in a sec -- I haven't worked out one for the others that it would make sense in (like wiki revision log and diff). Basically an optional argument is added to Formatter that specifies the url that the formatted thing is referring to. In the process, I noticed that Formatter and OneLinerFormatter take their arguments in a different order. Is this for some historical reason?
Attachments
Change History
Changed 5 years ago by Tim Hatch <trac@…>
- Attachment relative-links-fix.diff added
Changed 5 years ago by Tim Hatch <trac@…>
- Attachment relative-links-fix2.diff added
Second draft, all three types of links
comment:1 Changed 5 years ago by anonymous
I've added a new version of the patch which handles all three types of relative links (#ref, ./page, and /path/to/page) in all applicable wiki templates. I left wiki_view and wiki_edit alone since they already have the correct url in the browser, and don't need special care.
I couldn't figure an easy to unit-test this. Add manually to wiki/tests/formatter.py for with and without itemurl set?
comment:2 Changed 5 years ago by cboos
- Keywords context added
- Milestone set to 0.11
- Owner changed from jonas to cboos
Sorry for not having been able to comment on that earlier ... would have saved you some time.
No, there's no reason the #... links shouldn't work in the timeline or in other contexts. This is all related to the fact that currently the context of a wiki text (i.e. the resource to which the text belongs) is not propagated to the formatter. This introduces a lot of (minor) issues, not only this one, so it's something I'm going to address anyway.
comment:3 Changed 5 years ago by cboos
... and btw., it's because I anticipated this capability that I wrote such links in Wiki change comments ;)
comment:4 Changed 5 years ago by cboos
- Resolution set to fixed
- Status changed from new to closed
Fixed in r4451.



First-draft fix (timeline for hashrefs only)