#5903 closed defect (duplicate)
Enhanced detection of links
Reported by: | anonymous | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | BackLinksMacro |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.11 |
Description
In the current version (released on 08/19/08) are not detected correctly all types of links.
E.g. following links are not currently detected:
[wiki:"Name of the page"] NameOfThePage
It will be nice if future versions of the macro contain detection of these two additional link types. In our case we have a lot of these links and without patch macro is not so useful.
For my purpose I have modified existing source code (only for TRAC 0.11) and changed following lines.
Original source code:
if thispage: #sql += 'AND (w1.text LIKE \'%%[wiki:%s %%\' ' % (to_unicode(thispage, "utf-8").encode ("utf-8")) sql += 'AND (w1.text LIKE \'%%[wiki:%s %%\' ' % thispage sql += 'OR w1.text LIKE \'%%[wiki:%s]%%\')' % thispage #sql += 'OR w1.text LIKE \'%%[wiki:%s]%%\')' % (to_unicode (thispage, "utf-8").encode ("utf-8"))
My changes:
#sql += 'AND (w1.text LIKE \'%%[wiki:%s %%\' ' % (to_unicode(thispage, "utf-8").encode ("utf-8")) sql += 'AND (w1.text LIKE \'%%[wiki:%s %%\' ' % thispage sql += 'OR w1.text LIKE \'%%[wiki:%s]%%\'' % thispage sql += 'OR w1.text LIKE \'%%[wiki:"%s"]%%\'' % thispage sql += 'OR w1.text LIKE \'%%%s%%\')' % thispage #sql += 'OR w1.text LIKE \'%%[wiki:%s]%%\')' % (to_unicode (thispage, "utf-8").encode ("utf-8"))
Whole script is in the attachment.
Thanks a lot for incorporating these changes.
Attachments (1)
Change History (6)
Changed 15 years ago by
Attachment: | BackLinksMenu.zip added |
---|
comment:1 Changed 12 years ago by
Component: | BackLinksMenuMacro → BackLinksMacro |
---|
The functionality of BackLinksMenuMacro is being integrated into the BackLinksMacro.
comment:3 Changed 12 years ago by
(In [11969]) Refs #5903, #9175, #9503:
- Merged codebases for BackLinksMacro and BackLinksMenuMacro.
- Modified SQL query to utilize Trac's database agnostic API. Possible matches are captured with a LIKE clause, and then filtered with a regex in the Python code.
comment:4 Changed 12 years ago by
Owner: | changed from Trap to Ryan J Ollos |
---|
Feedback from testing is appreciated.
comment:5 Changed 9 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Enhanced detection of links