Folks,
With thanks to all and in this case mostly Mark S. My working solution is
as follows
\define fieldname-value() <$text text="""$(fieldname-value-temp)$"""/>
\define fieldsvalues()
<$list filter="[all[current]fields[]] -[[tiddler-template-caption]]
-[[text]] -[[title]] -[[created]] -[[modified]]
-[[tiddler-template-caption]]" variable="field"><$set name=
"fieldname-value-temp" tiddler=<<currentTiddler>> field=<<field>> emptyValue
=""><<field>>="<<fieldname-value>>" </$set> </$list>
\end
\define clone-current-actions()
<$action-createtiddler $basetitle={{!!title}} $savetitle=
"$:/temp/clone-current-title" $(attribs)$ text={{!!text}} />
<$action-navigate $to={{$:/temp/clone-current-title}}/>
\end
\define clone-template-actions()
<$action-createtiddler $basetitle={{!!instance-of}} $savetitle=
"$:/temp/clone-template-title" $(attribs)$ text={{!!text}} />
<$action-navigate $to={{$:/temp/clone-template-title}}/>
\end
\define clone-tiddler(tiddlername)
<$set name=tiddlername value="$tiddlername$" emptyValue=<<currentTiddler>> >
<$tiddler tiddler=<<tiddlername>> >
<$wikify name="attribs" text=<<fieldsvalues>> >
<$button actions=<<clone-current-actions>>class=<<tv-config-toolbar-class>>
>Clone
</$button>
</$wikify>
</$tiddler>
</$set>
\end
\define new-template-instance(tiddlername,tags)
<$set name=tiddlername value="$tiddlername$" emptyValue=<<currentTiddler>> >
<$tiddler tiddler=<<tiddlername>> >
<$wikify name="attribs" text=<<fieldsvalues>> >
<$button actions=<<clone-template-actions>>
class=<<tv-config-toolbar-class>> >New Instance
<$action-sendmessage $message="tm-edit-tiddler"
$param={{$:/temp/clone-template-title}}/>
</$button>
</$wikify>
</$tiddler>
</$set>
\end
;Named tiddler
New Order<<clone-tiddler "$:/New order/template">> Clone
New Order<<new-template-instance "$:/New order/template">> Template
;On current tiddler
Clone this<<clone-tiddler>>
Template this<<new-template-instance>> Only works if the current tiddler
has an "instance-of" field with a basetitle
I will be building this into a Tiddler Template solution and aim to share
that.
I altered same names to help me understand marks code. See the macro
invocations at the bottom
- clone-tiddler simply copies the tiddler to a new tiddler with the name
iterated, with the exception of some fields. But all tags and the text.
- new-template-instance does the same as clone but gets the new tiddler
name from instance-of field (usually in a template tiddler) and has a
different save title.
- Both record the source tiddler in the new one
I hope this helps someone!
Tony
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/987afde2-c7f8-4d1f-872e-28a077f6c807%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.