Edgewall Software

Ticket #4144 (closed defect: fixed)

Opened 2 years ago

Last modified 2 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:

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

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

Change History

Changed 2 years ago by Tim Hatch <trac@…>

First-draft fix (timeline for hashrefs only)

Changed 2 years ago by Tim Hatch <trac@…>

Second draft, all three types of links

Changed 2 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?

Changed 2 years ago by cboos

  • keywords context added
  • owner changed from jonas to cboos
  • milestone set to 0.11

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.

Changed 2 years ago by cboos

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

Changed 2 years ago by cboos

  • status changed from new to closed
  • resolution set to fixed

Fixed in r4451.

Add/Change #4144 (Relative links in wiki change messages are still relative when displayed elsewhere)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cboos. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.