Opened 7 years ago

Closed 7 years ago

# Changeset 9586 generates unwanted links on Trac 0.12

Reported by: Owned by: Ben Allen Ryan J Ollos high AcronymsPlugin normal 0.12

### Description

The recent changes made in r9586 are causing Trac 0.12 to turn all acronyms into links.

For example, I have the following defined in my AcronymDefinitions:

||'''Acronym'''||'''Description'''||


When I use the text Acronym test ROM. on a wiki page, the following HTML is generated:

Acronym test <a class="acronym" href="/MyProject/wiki/"><acronym title="Read-Only Memory">ROM</acronym></a>.


If I comment out lines 62-63 of acronyms.py (the lines added in r9586), then the resulting HTML code is as expected:

Acronym test <acronym title="Read-Only Memory">ROM</acronym>.


I suspect that this is due to the templating differences between 0.11 and 0.12, as 'href' is of type 'genshi._speedups.Markup' at line 61 (which causes the conditional on line 62 to always evaluate true).

I know Trac 0.12 isn't listed as being 'officially' supported by this plugin, but this bug seems to be the only thing keeping it from working so I figured I'd report it.

### comment:1 Changed 7 years ago by Ben Allen

Based on my initial experimentation, changing the following lines:

if not urlparse(href).scheme:
href = self.env.href.wiki(href)


to:

if (not urlparse(href).scheme) and (len(href.__str__()) > 0):
href = self.env.href.wiki(href)


seems to have fixed the problem. I haven't done extensive testing, but acronyms both with and without links seem to generate correct code (even for wiki sub-pages).

### comment:2 Changed 7 years ago by Ryan J Ollos

Priority: normal → high new → assigned

Thanks for the report. Your solution appears to be correct. I will try to get it patched by this weekend.

### comment:3 Changed 7 years ago by Ryan J Ollos

Definite error here on my part, and the issue almost certainly existed in Trac 0.11 as well. Posting a fix shortly.

### comment:4 Changed 7 years ago by Ryan J Ollos

Resolution: → fixed assigned → closed

(In [9741]) In [9586], a defect was introduced whereby acronyms without a URL definition would generate links to WikiStart. Thanks to AllenB for catching this. Fixes #8327.

### Modify Ticket

Change Properties