Rendering variables or tiddlers within commented text

43 views
Skip to first unread message

Fidel N

unread,
Dec 5, 2016, 1:46:58 PM12/5/16
to TiddlyWiki
Hey all:

Is there a way to render a variable (or the content of another tiddler) within commented text?

For instance, say our variable <<my_variable>> contains the value "apple":

Is there any way to make the following tw text:

```
This is my text
<<my_variable>>
```

Render as:

This is my text
apple

Thanks!

Mark S.

unread,
Dec 5, 2016, 2:54:45 PM12/5/16
to TiddlyWiki
The whole point of the comment text is to show the literal value of the following text. But you can interpolate into the text if you move the actual text into a macro and then pass the terms you want as arguments. Here is an example:

\define mytext(word1 word2)
```
This is my template that features the word: $word1$ and the word $word2$.
Aren't they great?
```

\end

<<mytext chicken cat>>

HTH
Mark

Fidel N

unread,
Dec 5, 2016, 3:15:44 PM12/5/16
to TiddlyWiki
Awesome, thanks!!
Yes I understand hehe, but the purpose is to be able to generate dynamic code, so when you define some tiddler values, it will render with the values for a specific setup, but still commented as code.

Thanks again :D
Reply all
Reply to author
Forward
0 new messages