[TW5] Macros

175 views
Skip to first unread message

Fatso Tutor

unread,
Mar 22, 2016, 8:54:09 PM3/22/16
to TiddlyWiki
Hi Guys,

I am keen on progressing my understanding of TW5. I would like to start writing some macros. I do not have an Javascript skills. I do a bit of python development on my iphone though not a developer. The problem - I know very little about them. Can someone write us a dummies tutorial for macros or point us to a resource with this.

Best regards.

Scott Simmons (Secret-HQ)

unread,
Mar 23, 2016, 12:25:56 AM3/23/16
to TiddlyWiki
This may be a good place to start:


In general, TW5 macros aren't "programmatic" so much as they're shortcuts.  For example, you could put this at the beginning of a tiddler:

\define mymacro()
This here is my macro.
\end

And then write this anywhere in the tiddler:

<<mymacro>>

To display the text:

This here is my macro.

By putting a macro in its own tiddler and tagging that tiddler $:/tags/Macro, you can write a macro call to it anywhere in your TiddlyWiki (not just in the tiddler where it's defined).


You can also pass variables into macros when you call them, but that's about the most "programmatic" thing they do.

For example:

/define mysecondmacro(adjective feeling)
This is my $adjective$ macro, and it makes me feel $feeling$.
/
end

If you refer to this macro like so:

<<mysecondmacro "other" "like a macro-making champion">>

Or like so:

<<mysecondmacro adjective:"other" feeling:"like a macro-making champion">>

... you'll see this text displayed:

This is my other macro, and it makes me feel like a macro-making champion.


At least, that's the basic gist of it.  ;)

Hegart Dmishiv

unread,
Mar 23, 2016, 1:03:59 AM3/23/16
to TiddlyWiki
Hi,

Professor Schneider of {{DesignWrite}} mentioned in a recent Workshop that he will be covering macros soon for the GuidedDevelopment stream of the second half of the current semester. You might like to keep an eye on that for the upcoming lessons and exercises.

Hegart.

Fatso Tutor

unread,
Mar 23, 2016, 3:33:54 AM3/23/16
to TiddlyWiki
Thanks Scott. That is the sort of guidance i was after.

Fatso Tutor

unread,
Mar 23, 2016, 3:34:36 AM3/23/16
to TiddlyWiki
Hi Hegart,I am looking forward to this topic.

Ed

unread,
Mar 24, 2016, 9:25:36 AM3/24/16
to TiddlyWiki
Hi Scott,

Thanks from another novice!

Salut! Edm.
=====

Op woensdag 23 maart 2016 05:25:56 UTC+1 schreef Scott Simmons (Secret-HQ):
Reply all
Reply to author
Forward
0 new messages