Understanding Templates, Macros, Etc.

167 views
Skip to first unread message

Randy J. Ray

unread,
May 29, 2021, 5:36:29 PM5/29/21
to tiddl...@googlegroups.com

Please forgive the somewhat newbie-ish post. What I am trying to do is similar to something another list member posted about recently, but I was still new to the list and getting my mail app to properly file list-mail. As such, I lost some of the threads.

I use TiddlyWiki a fair amount, with different wikis for different purposes: one for coding projects, one for master's thesis research, one for my scale modeling hobby projects, etc. But for each of these I have a similar need: I want to be able to create a new tiddler with some amount of text already present (generally just a collection of headings at different levels).

Using the scale modeling wiki as an example: I want to be able to click a button and create a new "Project" tiddler, in which a few basic tags are set but which also has the skeleton content of:

!!Materials

!!!Kits/Aftermarket

!!!Accessories

!!References

!!Web References

!!Notes

I have similar needs for the other wikis, but different basic structure.

I would normally think of this sort of thing as a template, but I think that TW uses template to mean something different? I found a very close sample of this on the Grok TiddlyWiki site, using "$action-sendmessage" and "tm-new-tiddler", but it wasn't clear how to include body content.

Thanks in advance,

Randy

-- 
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Randy J. Ray      San Jose, CA
rj...@blackperl.com
twitter.com/rjray
Silicon Valley Scale Modelers: http://www.svsm.org

Eric Shulman

unread,
May 29, 2021, 6:21:37 PM5/29/21
to TiddlyWiki
On Saturday, May 29, 2021 at 2:36:29 PM UTC-7 rj...@blackperl.com wrote:

Please forgive the somewhat newbie-ish post.

You don't need to ask for "forgiveness"... this group welcomes "newbies" with open arms. 

I want to be able to click a button and create a new "Project" tiddler, in which a few basic tags are set but which also has the skeleton content of:

!!Materials

!!!Kits/Aftermarket

!!!Accessories

!!References

!!Web References

!!Notes


1) First, create a tiddler (e.g., "ProjectStarter"), containing the desired "skeleton content" and tags.
2) Next add the following $button wherever you like:
<$button message="tm-new-tiddler" param="ProjectStarter">New Project</$button>

That's it.  When you press the "New Project" button, it will open a new tiddler for editing with the indicated default starting content.

enjoy,
-e


TiddlyTweeter

unread,
May 30, 2021, 3:01:04 AM5/30/21
to TiddlyWiki
Ciao Eric

Truthfully, your solutions are usually so elegant and to-the-point it is astonishing.
You are everyone's aid. 
Both Newbie (hi rj ...!) and Long-In-the-Tooth.

I truly wish that we could publicly UPVOTE on this group.
I am sure you would get huge numbers of upvotes for SOLVING problems.
Such upvotes would help end-users find viable solutions.

Best wishes
TT

Randy J. Ray

unread,
May 30, 2021, 3:35:52 PM5/30/21
to tiddl...@googlegroups.com

It is good to be welcomed, even as a newcomer. Many communities are not so generous :-).

One follow-up question, though: when you say, "add the following $button wherever you like", do you mean within an existing tiddler? Or is there a way to assign it an icon and have it be an action that I can configure into my main menu-bar?

Randy

--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/dfb7829e-31c8-468b-9777-e407e9b5f588n%40googlegroups.com.

Eric Shulman

unread,
May 30, 2021, 3:53:49 PM5/30/21
to TiddlyWiki
On Sunday, May 30, 2021 at 12:35:52 PM UTC-7 rj...@blackperl.com wrote:

is there a way to assign it an icon and have it be an action that I can configure into my main menu-bar?

1) First, create a tiddler (e.g., "New Project"), containing the desired "skeleton content" and tags.
2) Next, create a tiddler (e.g., "NewProjectButton"), containing a $button definition like this:
<$button message="tm-new-tiddler" param="New Project" tooltip="Create a new Project tiddler" class="tc-btn-invisible">
   {{$:/core/images/spiral}}
</$button>
3) Tag "NewProjectButton" with $:/tags/PageControls

Notes:
* You can name the tiddlers anything you like
* Use class="tc-btn-invisible" so the $button just displays the icon without any border or background color
* Replace $:/core/images/spiral with any tiddler containing a small button-sized image

enjoy,
-e

Hans Wobbe

unread,
May 31, 2021, 2:05:25 PM5/31/21
to TiddlyWiki
Nice!

The smacking sound you probably heard was my palm hitting my forhead.  It simply had not occured to me to use ...PageControls to add key buttons in this manner.

Thank to both of you for an informative Question and Answer.

Cheers,
Hans
Reply all
Reply to author
Forward
0 new messages