Modify

Opened 17 years ago

Closed 12 years ago

Last modified 12 years ago

#2407 closed defect (wontfix)

Not renaming sub pages

Reported by: anonymous Owned by: Noah Kantrowitz
Priority: normal Component: WikiRenamePlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

If you have a main page with a sub page, e.g. MainPage and MainPage/SubPage

When you rename MainPage to NewMainPage the subpage is not renamed as one would expect to NewMainPage/SubPage

Attachments (0)

Change History (5)

comment:1 Changed 16 years ago by bialix

automatically renaming all subpages maybe good idea but may be not: e.g. in the case when you have many subpages and sub-subpages. This may create unnecessary recurse. May be it should be done with some flag (checkbox maybe) to enable recurse renaming.

But currently wikirenameplugin update all links that match even partially to new name and it eventually break all navigation. Can you fix at least this part? I.e. don't update link to MainPage/SubPage with NewMainPage/SubPage link. Currently I encounter this bug every time I try to reorganize my very big hierarchical tree of wiki pages.

comment:2 Changed 16 years ago by bialix

Simple patch to prevent renaming link to subpages:

=== modified file 'wikirename/util.py'
--- wikirename/util.py 12.11.2006 15:10:43
+++ wikirename/util.py 29.05.2008 14:40:25
@@ -82,7 +82,7 @@
     # Rewrite all links to the old page, such as to point to the new page
     for row in list(cursor):
         debug("Found a page with a backlink in it: %s (v%s)", row[1], row[0])
-        newtext = sre.sub('\[wiki:%s'%oldname,'[wiki:%s'%newname,row[2])
+        newtext = sre.sub('\[wiki:%s(?!/)'%oldname,'[wiki:%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:
 

If you will decide to include this patch, please update version for Trac 0.10 as well.

comment:3 Changed 15 years ago by honzam+trac@…

Wouldn't be better patch like this?

=== modified file 'wikirename/util.py'
--- wikirename/util.py 12.11.2006 15:10:43
+++ wikirename/util.py 29.05.2008 14:40:25
@@ -82,7 +82,7 @@
     # Rewrite all links to the old page, such as to point to the new page
     for row in list(cursor):
         debug("Found a page with a backlink in it: %s (v%s)", row[1], row[0])
-        newtext = re.sub('\[wiki:%s'%oldname,'[wiki:%s'%newname,row[2])
+        newtext = re.sub('\[wiki:%s(?=[ ]])'%oldname,'[wiki:%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:

comment:4 Changed 12 years ago by Ryan J Ollos

Resolution: wontfix
Status: newclosed

The plugin is deprecated since there is now support in the Trac core.

comment:5 Changed 12 years ago by Ryan J Ollos

If you'd like to apply patches I can provide you commit access.

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.