Okay I got it...had to make a small plugin, but it appears to work...

/*\ title: $:/core/modules/macros/tw5filterTemplatePrefix.js 
      type: application/javascript module-type: macro Macro to return 
something less the prefix. 
 \*/ 
(function(){ /*jslint node: true, browser: true */ 
                     /*global $tw: false */ 
                     "use strict"; 
                     /* Information about this macro */ 

    exports.name = "tw5filterTemplatePrefix"; 
    exports.params = [ {name: "m"} ]; 

   /* Run the macro m: is the Tiddler Template Title returns: The name of 
the Tiddler less the template. */ 
   exports.run = function(m, v) { return m.replace(/Template/i, ""); }; 
 })();  

*$:/core/modules/macros/tw5filterTemplatePrefix.js  *

<!--
     Name: testCreate()
     Purpose: Macro that uses the specified tiddler as a template for  
                      copying / cloning / duplicating it into a new one 
with a 
                      specified suffix.
 
     Macro required variables:
            - $(whichTiddlerTemplate)$ - The name of the src tiddler to be 
copied
            - $(tiddlerToCreate)$ - The name of the new tiddler to create 
minus the suffix.
            - $(dasSuffix)$ - The suffix of the new tiddler to create.

     Macro required shadow tiddlers:
            - $:/state/tab-1749438307 - stores the name of the copied, 
cloned, duplicated tiddler.

     Dependency macros:
            - createDasTid()
 -->
\define testCreate()

<!-- Set this field for use later when we generate the title of the new 
copied/duplicated/cloned tiddler -->
<$action-setfield $tiddler="$:/state/tab-1749438307" 
text="$(tiddlerToCreate)$ - $(dasSuffix)$" />

<!-- Create a copy of a tiddler based on another. -->
<<createDasTid>>

\end

<!--
     Name: createDasTid()
     Purpose: Macro that makes a copy of the tiddler.
 
     Macro required variables:
            - $(whichTiddlerTemplate)$ - The name of the src tiddler to be 
copied

     Macro required shadow tiddlers:
            - $:/state/tab-1749438307 - stores the name of the tiddler to 
be copied / cloned / duplicated.

 -->
\define createDasTid()

<$action-createtiddler $template="$(whichTiddlerTemplate)$" 
$basetitle={{$:/state/tab-1749438307}}  tags="deltag"  />

\end

\define removeTemplatePrefix()
<!-- Calls the Plugin above -->
<<tw5filterTemplatePrefix m:"$(whichTiddlerTemplate)$">>
\end

<!-- Whatever is typed into this textbox is stored in the 
$:/state/new-tiddler-suffix system/shadow tiddler -->
''Suffix:'' <$edit-text tiddler="$:/state/new-tiddler-suffix" tag="input" 
default=""/>

<!-- Begin button to duplicate all from template tiddlers -->
<$button>
<!-- Once this script obtains a list of template tiddlers based on their 
tags and
      titles, it needs to know two things about each tiddler that it 
replicates

       1. The name of the existing Template tiddler.
       2. The name of the new cloned Tiddler created from the tiddler 
template.
          2.1 (The new suffix for each cloned/duplicated/copied tiddler)
  -->
<!-- Each Tiddler to be used as a template and duplicated 
      is tagged with both of the following tags: "templates", and 
"EditingTemplate"
      and here we obtain them to be gone through using the currentTiddler 
variable, 
      one at a time after the button is clicked.

      Each of these tiddlers also ends with the suffix "Template" which 
needs to be removed
      later on by the removeTemplatePrefix macro when generating the name 
of the newly created
      tiddler.
 -->
<$list filter="[tag[templates]tag[EditingTemplate]]">
    <!-- Start setting variables for this iteration of the loop, each 
variable set for this iteration will be 
          used within the macro definitions above when they are called. 
(removeTemplatePrefix and testCreate for instance)  -->
    <!-- Set a variable within this iteration of the loop which contains 
the suffix specified in the Suffix: textbox above. -->
    <$set name="dasSuffix" value={{$:/state/new-tiddler-suffix}}>
         <!-- Set a variable that specifies which tiddler template to 
clone/duplicate/copy from 
               the current tiddler we are iterating over.  -->  
         <$set name="whichTiddlerTemplate" value=<<currentTiddler>> >
         <!-- Create a variable named "tiddlerToCreate" from the result of 
calling the removeTemplatePrefix macro and 
                then wifiy it so it is parsed and rendered. -->
          <$wikify name="tiddlerToCreate" text=<<removeTemplatePrefix>> >
               <!-- Call the testCreate macro to create the 
clone/copy/duplicate of the tiddler being itterated over. -->
               <<testCreate>>
         </$wikify>
      </$set>
    </$set>
</$list>
Create From Editing Template
</$button>

*Tiddler: CreateTiddlersFromTemplates*

This appears to work if you leave all the <!-- --> comments out, I should 
probably add something for the tags as well.

On Saturday, 5 September 2020 at 15:59:13 UTC-4 saq.i...@gmail.com wrote:

> PS: I realize now you may want addSuffix and not removeSuffix. Apologies.
>
>
> On Saturday, September 5, 2020 at 9:57:05 PM UTC+2, Saq Imtiaz wrote:
>>
>> Something along these lines will get you there:
>>
>> <$set name="tiddlerToCreateFromTemplate" 
>>     value={{{[<whichTiddlerTemplateName>removeSuffix[Underground]]}}} >
>>
>> OR simplify
>>
>> <$list filter="[tag[templates]tag[EditingTemplate]]">
>> <$set name="tiddlerToCreateFromTemplate" 
>>     value={{{[<currentTiddler>removeSuffix[Underground]]}}} >
>> Use This Template: <<currentTiddler>><br/>
>> Create This Tiddler From Template: <<tiddlerToCreateFromTemplate>><br/>
>> <hr/>
>> </$set>
>> </$list>
>>
>> On Saturday, September 5, 2020 at 9:05:24 PM UTC+2, leeand00 wrote:
>>>
>>> So I'm using a filter, and it's working great to remove the suffix and 
>>> add another one...see below:
>>>
>>> [tag[templates]tag[EditingTemplate]] +[removesuffix[Template]] 
>>> +[addsuffix[ - Underground]]
>>>
>>> Result:
>>>
>>> Spelling - Underground 
>>> <http://wiki.helpdeskaleer.com:8080/jobhunt/softskills/email/plainlanguage#Spelling%20-%20Underground>
>>> PunctuationMistakes - Underground 
>>> <http://wiki.helpdeskaleer.com:8080/jobhunt/softskills/email/plainlanguage#PunctuationMistakes%20-%20Underground>
>>> VerbMistakes - Underground 
>>> <http://wiki.helpdeskaleer.com:8080/jobhunt/softskills/email/plainlanguage#VerbMistakes%20-%20Underground>
>>> CheckAdverbAdjectiveMistakes - Underground 
>>> <http://wiki.helpdeskaleer.com:8080/jobhunt/softskills/email/plainlanguage#CheckAdverbAdjectiveMistakes%20-%20Underground>
>>> CheckForUnnecesaryWordsMistakes - Underground 
>>> <http://wiki.helpdeskaleer.com:8080/jobhunt/softskills/email/plainlanguage#CheckForUnnecesaryWordsMistakes%20-%20Underground>
>>> LookForWeakSentancesAndPhrasesThatNeedMoreInformation - Underground 
>>> <http://wiki.helpdeskaleer.com:8080/jobhunt/softskills/email/plainlanguage#LookForWeakSentancesAndPhrasesThatNeedMoreInformation%20-%20Underground>
>>> LookForRepetitionOfWordsOrPhrases - Underground 
>>> <http://wiki.helpdeskaleer.com:8080/jobhunt/softskills/email/plainlanguage#LookForRepetitionOfWordsOrPhrases%20-%20Underground>
>>> LookForVaguePhrases - Underground 
>>> <http://wiki.helpdeskaleer.com:8080/jobhunt/softskills/email/plainlanguage#LookForVaguePhrases%20-%20Underground>
>>> CheckParagraphing - Underground 
>>> <http://wiki.helpdeskaleer.com:8080/jobhunt/softskills/email/plainlanguage#CheckParagraphing%20-%20Underground>
>>> CheckForDumbOrIllogicalStatements - Underground 
>>> <http://wiki.helpdeskaleer.com:8080/jobhunt/softskills/email/plainlanguage#CheckForDumbOrIllogicalStatements%20-%20Underground>
>>> CheckForColloquialismsSlangInformalPhrases - Underground 
>>> <http://wiki.helpdeskaleer.com:8080/jobhunt/softskills/email/plainlanguage#CheckForColloquialismsSlangInformalPhrases%20-%20Underground>
>>>
>>> But...what I really want to do here, is remove the suffix and add 
>>> another one in a variable so I can create a bunch of template tiddlers:
>>>
>>> <$list filter="[tag[templates]tag[EditingTemplate]]">
>>>   <$set name="whichTiddlerTemplateName" value=<<currentTiddler>> >
>>>    <$set name="tiddlerToCreateFromTemplate" 
>>> value="<<whichTiddlerTemplateName>> - Underground" >
>>> Use This Template: <<whichTiddlerTemplateName>><br/>
>>> Create This Tiddler From Template: <<tiddlerToCreateFromTemplate>><br/>
>>> <hr/>
>>> </$set>
>>> </$set>
>>> </$list>
>>>
>>> In the second <$set> above (" tiddlerToCreateFromTemplate") I want to be 
>>> able to remove the template prefix the way I did in the filter...so that I 
>>> get  Spelling - Underground 
>>> <http://wiki.helpdeskaleer.com:8080/jobhunt/softskills/email/plainlanguage#Spelling%20-%20Underground>
>>>   
>>> instead of  Spelling Template - Underground 
>>> <http://wiki.helpdeskaleer.com:8080/jobhunt/softskills/email/plainlanguage#Spelling%20-%20Underground>
>>>   
>>>
>>> how do I do that?  
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/be47ecad-4c7e-48d8-8e25-2b3a57dd3a17n%40googlegroups.com.

Reply via email to