> Currently, CT (pseudocode) does this:
>
> NewT = T + " (n)"  // eg: MyTiddler begets MyTiddler (1)
> When another copy is made we get MyTiddler (2) - but only as long as
> the source was *MyTiddler*.  If the source was MyTiddler (1) we get
> MyTiddler (1) (1) (or MyTiddler-1-1 in my hacked version).

CopyTiddlerPlugin is supposed to remove-and-replace the copy number
with the next incremental value, and it is working properly in my
documents, so it's a bit surprising that you are getting the results
you have observed.

Here's the *actual* code from the plugin (with annotations), which
shows that the desired functionality that you described is, in fact,
*exactly* what the code does:

First, find the existing "(#)" part of the title text (if any):
        var re=/ \(([0-9]+)\)$/; var match = re.exec(title);
Next, calculate the new copy number, "n" and remove the old copy
number from the title:
        var n=match?parseInt(match[1])+1:1; if (match) title=title.replace
(re,'');
Then construct the new tiddler title:
        var newTitle=this.prefix+title+this.suffix.format([n]);

The problem arises because you are no longer using (#) as a suffix...
even though you have changed the output format for the suffix to "-
#", the first line in the code shown above was still looking for the
"(#)" text pattern.

I've updated the plugin so that the suffix *pattern* can be properly
customized to match your customized suffix output *format*.

Also, please note that to change the format of the suffix, you should
not modify the plugin code.  Rather, you can simply create a new
tiddler called [[CopyTiddlerPluginConfig]], tagged with
'systemConfig', containing something like this:
   config.commands.copyTiddler.suffixText=" - %0";
   config.commands.copyTiddler.suffixPattern=/ - ([0-9]+)$/;
when you save-and-reload, CopyTiddlerPluginConfig is invoked
immediately after CopyTiddlerPlugin (because plugins are run in
alphabetical order).  Thus, this setting will supersede the default
value defined in the plugin, and your customized suffix format/pattern
will be used.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/TiddlyWiki?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to