Modify

Opened 8 years ago

Closed 2 years ago

#900 closed enhancement (wontfix)

Support for WikiTemplate plugin

Reported by: jpereira@… Owned by: coderanger
Priority: normal Component: WikiRenamePlugin
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description

Hi,

To start with, nice plugin, it's been immensly helpful in helping us keep our documentation organized. Follows a small patch to add support for the Include macro, by also renaming Include calls (yes, shameless copy/paste of your own code).

At the end of utils.py, add the following

   # Get a list of all wiki pages containing Includes to the old page
   if debug: env.log.debug( "WikiRename: Trying to fix includes" )
   sql = 'SELECT w1.version,w1.name,w1.text' + sqlbase + "AND w1.text like '%%[Include(%s)%%'" % oldname
   if debug: env.log.debug( "WikiRename: Running query '%s'" % sql )
   cursor.execute(sql)

   # Rewrite all links to the old page, such as to point to the new page
   for row in list(cursor):
       if debug: env.log.debug( "WikiRename: Found a page with an Include in it: %s (v%s)" % (row[1],row[0]) )
       newtext = sre.sub('\[Include\(%s\)'%oldname,'[Include(%s)'%newname,row[2])
       cursor.execute('UPDATE wiki SET text=%s WHERE name=%s AND version=%s', (newtext,row[1],row[0]))

   if handle_commit:
       db.commit()

right before

    if handle_commit:
        db.commit()

You might also feel like merging this query with the previous one and replace "wiki:" calls at the same time as "Include()" calls, but I actually prefer to keep them seperate.

I also suggest replacing the "if debug: print(" calls with "if debug: env.log.debug(" calls.

Thanks in advance,

  • Jorge Pereira

Attachments (0)

Change History (2)

comment:1 Changed 5 years ago by anonymous

Replying to:

You might also feel like merging this query with the previous one and replace "wiki:" calls at the same time as "Include()" calls, but I actually prefer to keep them seperate.

I also suggest replacing the "if debug: print(" calls with "if debug: env.log.debug(" calls.
Well this was proposed in patch of #606 too, but looking at the current code it seems to be rejected or still pending.

comment:2 Changed 2 years ago by rjollos

  • Resolution set to wontfix
  • Status changed from new to closed

0.10 version of the plugin is deprecated.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.