Opened 19 years ago
Closed 19 years ago
#2029 closed defect (fixed)
Wiki Links with no description should not strip the prefix for external links
Reported by: | Christian Boos | Owned by: | Christian Boos |
---|---|---|---|
Priority: | normal | Milestone: | 0.9 |
Component: | wiki system | Version: | 0.9b1 |
Severity: | minor | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
The implementation for #867 ([wiki:Sometext] -> Sometext
)
had a bad side-effect for external links: ([http://host] -> //host
).
I'll propose a patch for fixing this.
PS: Also contained in the patch is the possibility to
add a ]
in the link description, by enclosing the
description in '...'
or "..."
quotes, like
one can already do for the target.
Attachments (1)
Change History (6)
by , 19 years ago
Attachment: | external_link_fix.patch added |
---|
comment:1 by , 19 years ago
Status: | new → assigned |
---|
Forgot to "accept" the ticket I created.
(see #2045)
comment:2 by , 19 years ago
I don't understand this change completely:
-
formatter.py
289 289 target = fullmatch.group('ltgt') 290 290 if target and target[0] in "'\"": 291 291 target = target[1:-1] 292 label = fullmatch.group('label') or target 292 label = fullmatch.group('label') 293 if not label: 294 if target: 295 label = target.startswith('//') and ns+':'+target or target 296 else: 297 label = ns 298 if label and label[0] in "'\"": 299 label = label[1:-1] 293 300 rel = fullmatch.group('rel') 294 301 if rel: 295 302 return self._make_relative_link(rel, label or rel)
Why would target
be empty? I.e. in what case would the ns
be used as label? When removing the quotes around the label, why the if label
check? Shouldn't the label always be set at that point?
For removing the quotes, I think the following code would be better (as in more readable):
if label and label[0] in ("'", '"'): label = label[1:-1]
Finally, I'd also expand the and
/or
expression:
if target: label = target if label.startswith('//'): label = ns + ':' + label else: ...
(But again, I don't see why target
would be empty.)
comment:3 by , 19 years ago
There is a least one situation where the target can be empty:
[search: Search Trac]
→ Search Trac
This corresponds to #1937, which would be fixed by the above patch.
comment:4 by , 19 years ago
Okay, so if you integrate the syntax recommendations I made above, please apply the patch. I'm planning to release 0.9b2 today (or maybe tomorrow).
It would probably also be a good idea to add some comments to the blocks that aren't so obvious ;-).
comment:5 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
The initial patch