• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item6877: Auto-incrementing topic names using AUTOINC with optional trailing string

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Enhancement Closed   patch 5.1.2

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

This is a small enhancement to the AUTOINC* feature that auto-increments numbers for automatic topic creation.

Currently any prefix can be used, such as PrjAUTOINC001 to create Prj001, Prj002, Prj003, etc.

If the new topic or existing topics have a suffix, auto-increments no longer works as expected. For example, I'd like to have Prj001Foo, Prj002Bar, Prj003Moo, etc, where the suffix is specified at topic creation time, such as PrjAUTOINC001Foo .

This enhancement allows arbitrary suffix after the number.

Example:

  • Create topic using name PrjAUTOINC001FirstProject -- results in topic Prj001FirstProject
  • Create topic using name PrjAUTOINC001 -- results in topic Prj002
  • Create topic using name PrjAUTOINC001SomeSuffix -- results in topic Prj003SomeSuffix
Patch:
--- Save.pm.save1   2012-01-15 00:53:39.000000000 -0500
+++ Save.pm   2012-05-16 22:39:48.012810595 -0400
@@ -393,11 +393,11 @@
         my $baseTopic = $topic;
         $store->clearLease( $web, $baseTopic );
         my $nameFilter = $topic;
-        $nameFilter =~ s/AUTOINC([0-9]+)/([0-9]+)/;
+        $nameFilter =~ s/AUTOINC([0-9]+).*/([0-9]+)/;
         my @list =
           sort{ $a <=> $b }
-            map{ s/^$nameFilter$/$1/; s/^0*([0-9])/$1/; $_ }
-              grep{ /^$nameFilter$/ }
+            map{ s/^$nameFilter.*/$1/; s/^0*([0-9])/$1/; $_ }
+              grep{ /^$nameFilter/ }
                 $store->getTopicNames( $web );
         if( scalar @list ) {
             # find last one, and increment by one

-- TWiki:Main/PeterThoeny - 2012-05-17

Now in SVN trunk and 5.1 branch. Docs at TWikiTemplates updated too.

-- TWiki:Main/PeterThoeny - 2012-05-17

ItemTemplate
Summary Auto-incrementing topic names using AUTOINC with optional trailing string
ReportedBy TWiki:Main.PeterThoeny
Codebase ~twiki4, 5.1.1
SVN Range TWiki-5.1.1-trunk, Sun, 13 May 2012, build 22927
AppliesTo Engine
Component

Priority Enhancement
CurrentState Closed
WaitingFor

Checkins TWikirev:22940 TWikirev:22941 TWikirev:22942 TWikirev:22943
TargetRelease patch
ReleasedIn 5.1.2
Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2012-10-07 - PeterThoeny
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback