Modify

Opened 18 years ago

Closed 13 years ago

#900 closed enhancement (wontfix)

Support for WikiTemplate plugin

Reported by: jpereira@… Owned by: Noah Kantrowitz
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 15 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 13 years ago by Ryan J Ollos

Resolution: wontfix
Status: newclosed

0.10 version of the plugin is deprecated.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Noah Kantrowitz.
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.