Ticket #64 (closed Task: fixed)

Opened 9 years ago

Last modified 9 years ago

Install BackLinksMacro in Trac

Reported by: irau Owned by: dgf
Priority: Major Milestone:
Component: Trac Version:
Keywords: Cc:
Complexity: 3 Area:
Module:

Change History

comment:2 Changed 9 years ago by irau

  • Status changed from closed to reopened
  • Resolution fixed deleted

Tested the macro in SandBox. It does not work yet as expected though.

The Pages IngoRau, SandBoxOne, SandBoxTwo and SandBoxThree all link to SandBox. The BackLinks Macro on SandBox however only reflects the references from SandBoxTwo and SandBoxThree? The other ones don't show.

Any ideas?

comment:3 Changed 9 years ago by dgf

  • Status changed from reopened to closed
  • Complexity changed from 2 to 3
  • Resolution set to fixed

the backlink macro queries all wiki pages with simple SQL like expressions

snippet from source

        if thispage:
              sql += 'AND (w1.text LIKE \'%%[wiki:%s %%\'' % thispage
              sql += ' OR w1.text LIKE \'%%[wiki:%s]%%\'' % thispage
              if self._check_unicode_camelcase(thispage):
                      sql += ' OR w1.text LIKE \'%%\n%s %%\'' % thispage
                      sql += ' OR w1.text LIKE \'%% %s %%\'' % thispage
                      sql += ' OR w1.text LIKE \'%%\n%s\r%%\'' % thispage
                      sql += ' OR w1.text LIKE \'%% %s\r%%\'' % thispage
              sql += ')'

to support punctuations and brackets, i add some additional disjunctive combinations

                      sql += ' OR w1.text LIKE \'%% %s.%%\'' % thispage
                      sql += ' OR w1.text LIKE \'%% %s,%%\'' % thispage
                      sql += ' OR w1.text LIKE \'%% %s?%%\'' % thispage
                      sql += ' OR w1.text LIKE \'%% %s)%%\'' % thispage
                      sql += ' OR w1.text LIKE \'%%(%s %%\'' % thispage

if other combintations needed, please report them or use a space between the sign and the wiki reference

Note: See TracTickets for help on using tickets.