Modify

Opened 15 years ago

Closed 8 years ago

Last modified 8 years ago

#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)

BackLinksMenu.zip (1.1 KB) - added by anonymous 15 years ago.
Enhanced detection of links

Download all attachments as: .zip

Change History (6)

Changed 15 years ago by anonymous

Attachment: BackLinksMenu.zip added

Enhanced detection of links

comment:1 Changed 12 years ago by Ryan J Ollos

Component: BackLinksMenuMacroBackLinksMacro

The functionality of BackLinksMenuMacro is being integrated into the BackLinksMacro.

comment:2 Changed 12 years ago by Ryan J Ollos

#6611 closed as a duplicate.

comment:3 Changed 12 years ago by Ryan J Ollos

(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 Ryan J Ollos

Owner: changed from Trap to Ryan J Ollos

Feedback from testing is appreciated.

comment:5 Changed 8 years ago by Ryan J Ollos

Resolution: duplicate
Status: newclosed

This should be resolved by the use of the TracLinks parser from Trac, suggested in #12619.

Version 0, edited 8 years ago by Ryan J Ollos (next)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.