Embedding macro in template

60 views
Skip to first unread message

Ronen Teva

unread,
Oct 16, 2012, 6:57:23 PM10/16/12
to tiddl...@googlegroups.com
Hi,
I'm trying to show the list of tags at the end of each tiddler.

I successfully used the forEachTiddler plugin.
How can I embed it in the ViewTemplate tiddler?

I don't want to use the default tagging macro because I want to modify the results (for example, show a link "remove" after each tag)


Any help will be highly appreciated.

Eric Shulman

unread,
Oct 16, 2012, 7:17:03 PM10/16/12
to TiddlyWiki
> I'm trying to show the list of tags at the end of each tiddler.
>
> I successfully used the forEachTiddler plugin.
> How can I embed it in the ViewTemplate tiddler?

The easiest way to embed arbitrary macro output in the ViewTemplate is
to use the "tiddler" macro:
<span macro="tiddler NameOfTiddler"></span>
and then put your normal macro definition into the referenced tiddler.

Optionally you can also use an evaluated parameter in the template
syntax, to automatically pass the title of the current tiddler, like
this:
<span macro="tiddler NameOfTiddler with: {{tiddler.title}}"></span>
This will allow you to use the "$1" *replacement marker* within the
embedded tiddler, so that the macro it invokes can use the current
tiddler title when computing it's output.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...
http://www.TiddlyTools.com/#Donations

Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:
http://www.TiddlyTools.com/#Contact


This avoids mixing the use of quotes for 'template syntax' and
'macro syntax'

TonyM

unread,
Oct 16, 2012, 7:22:44 PM10/16/12
to tiddl...@googlegroups.com
Eris has done a better job before me but I was going to say;

You can include in your template code such as this;

<div class='viewer' macro='tiddler ExtendTask'></div>

<span macro="showWhenTagged TiddlerMenu">
    <div class='viewer' macro='tiddler ExtendTask'></div>
</span>

The second needs the hidewhenplugin

The ExtendTask tiddler will then be rendered at that point in your tiddler.
I use http://www.TiddlyTools.com/#TaggedTemplateTweak

Tony
Message has been deleted

Ronen Teva

unread,
Oct 17, 2012, 2:54:09 AM10/17/12
to tiddl...@googlegroups.com
Thank you both so much!!
Reply all
Reply to author
Forward
0 new messages