Edgewall Software

Opened 16 years ago

Closed 16 years ago

#4144 closed defect (fixed)

Relative links in wiki change messages are still relative when displayed elsewhere

Reported by: Tim Hatch <trac@…> Owned by: Christian Boos
Priority: low Milestone: 0.11
Component: wiki system Version: devel
Severity: minor Keywords: context
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:


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 (2)

relative-links-fix.diff (3.0 KB ) - added by Tim Hatch <trac@…> 16 years ago.
First-draft fix (timeline for hashrefs only)
relative-links-fix2.diff (4.7 KB ) - added by Tim Hatch <trac@…> 16 years ago.
Second draft, all three types of links

Download all attachments as: .zip

Change History (6)

by Tim Hatch <trac@…>, 16 years ago

Attachment: relative-links-fix.diff added

First-draft fix (timeline for hashrefs only)

by Tim Hatch <trac@…>, 16 years ago

Attachment: relative-links-fix2.diff added

Second draft, all three types of links

comment:1 by anonymous, 16 years ago

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 by Christian Boos, 16 years ago

Keywords: context added
Milestone: 0.11
Owner: changed from Jonas Borgström to Christian Boos

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 by Christian Boos, 16 years ago

… and btw., it's because I anticipated this capability that I wrote such links in Wiki change comments ;)

comment:4 by Christian Boos, 16 years ago

Resolution: fixed
Status: newclosed

Fixed in r4451.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.