Opened 18 years ago
Closed 18 years ago
#4144 closed defect (fixed)
Relative links in wiki change messages are still relative when displayed elsewhere
Reported by: | 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: |
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 (2)
Change History (6)
by , 18 years ago
Attachment: | relative-links-fix.diff added |
---|
by , 18 years ago
Attachment: | relative-links-fix2.diff added |
---|
Second draft, all three types of links
comment:1 by , 18 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 , 18 years ago
Keywords: | context added |
---|---|
Milestone: | → 0.11 |
Owner: | changed from | to
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 , 18 years ago
… and btw., it's because I anticipated this capability that I wrote such links in Wiki change comments ;)
First-draft fix (timeline for hashrefs only)