Modify ↓
Opened 18 years ago
Closed 13 years ago
#900 closed enhancement (wontfix)
Support for WikiTemplate plugin
Reported by: | 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
comment:2 Changed 13 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
0.10 version of the plugin is deprecated.
Note: See
TracTickets for help on using
tickets.
Replying to:
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.