Modify ↓
Opened 16 years ago
Closed 15 years ago
#4051 closed defect (fixed)
[Patch] BackLinksMacro
Reported by: | anonymous | Owned by: | Trap |
---|---|---|---|
Priority: | normal | Component: | BackLinksMacro |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.10 |
Description
SQL in 0.11 version looks for explicit wiki links but not simple CamelCase references to thispage.
Revised query as shown below:
if thispage: sql += 'AND (w1.text LIKE \'%%[wiki:%s %%\' ' % thispage sql += 'OR w1.text LIKE \'%%[wiki:%s]%%\' ' % thispage sql += 'OR w1.text LIKE \'%%%s%%\')' % thispage
The plugin works for me now in 0.11 with sqlite3.
Attachments (2)
Change History (7)
comment:1 Changed 16 years ago by
comment:2 Changed 16 years ago by
Here's a patch for the 0.10 version. The primary difference between this patch and the code above is that this patch filters out things that use the !NoLinkHere syntax.
--- BackLinks.py.orig 2008-01-31 15:39:26.000000000 -0500 +++ BackLinks.py 2009-02-06 23:43:41.000000000 -0500 @@ -19,8 +19,12 @@ '(SELECT name, MAX(version) AS VERSION FROM WIKI GROUP BY NAME) w2 ' + \ 'WHERE w1.version = w2.version AND w1.name = w2.name ' if thispage: - sql += 'AND (w1.text LIKE \'%%[wiki:%s %%\' ' % (unicode(thispage, "utf-8").encode ("utf-8")) - sql += 'OR w1.text LIKE \'%%[wiki:%s]%%\')' % (unicode (thispage, "utf-8").encode ("utf-8")) + utf8 = unicode(thispage, "utf-8").encode("utf-8") + sql += 'AND (w1.text LIKE \'%%[wiki:%s %%\' ' % utf8 + sql += 'OR w1.text LIKE \'%%[wiki:%s]%%\' ' % utf8 + if thispage[1:].lower() != thispage[1:]: + sql += "OR replace(w1.text, '!%s', '') LIKE '%%%s%%' " % (utf8, utf8) + sql += ')' cursor.execute(sql) buf = StringIO() buf.write('<hr style="width: 10%; padding: 0; margin: 2em 0 1em 0;"/>')
Changed 15 years ago by
Attachment: | BackLink.5.CamelCase.Fix.patch added |
---|
Changed 15 years ago by
Attachment: | BackLink.5.CamelCase.Fix.2.patch added |
---|
comment:4 Changed 15 years ago by
Summary: | BackLinksMacro → [Patch] BackLinksMacro |
---|
comment:5 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
I've got your suggestions and I fixed in r7509
Thank you.
Note: See
TracTickets for help on using
tickets.
That's great. Thanks for submitting the fix! Tested and working on 0.11b with sqlite3.