[TW5] How to put "[["<<currentTiddler>>"]]" to tiddler?

104 views
Skip to first unread message

sini-Kit

unread,
Mar 4, 2016, 12:21:02 AM3/4/16
to TiddlyWiki
Hi! I make little macros. it renders tiddler from select. But if tiddler have space in it's title this macros don't work.

\define ttt()
<$select tiddler='$:/temp/generated-list-demo-state-$(TestList)$'>
<$list filter='345336 3453434 45645645 3453453411 [[3454356 1]] [[43547776 1 1]] [[544345 1 1]] [[5675678 1 1]] [[967875 1 1]]'>
<option value= <<currentTiddler>> ><$view field='nazvanie'/></option>
</$list>
</$select>
<$tiddler tiddler={{$:/temp/generated-list-demo-state-$(TestList)$}}>
<$list filter=<<currentTiddler>>>  <span class="textboxtop textboxwhite ">
   {{||$:/_tile_images}}     </span>
</$list>
</$tiddler>
\end

<$set name=TestList value=<<currentTiddler>>  >
<<ttt>>
</$set>

  to make it work it is necessary to put tiddler title to  demo-state- with [[]]  but I don't know how to do it.
if I remove  <$list filter=<<currentTiddler>>> it shows empty result if demo-state- is empty...

c pa

unread,
Mar 4, 2016, 5:23:36 PM3/4/16
to TiddlyWiki
This is my guess at what you are doing
#1 You place the name of a tiddler in another tiddler named $:/temp/generated-list-demo-state-$(TestList)$
#2 In the named tiddler you have an image
#3 You have another tiddler named
$:/_tile_images with some display logic that when transcluded displays the image

To fix it
#1 change row 1 to "\define ttt(value)"
#2 change row
7 to "<$tiddler tiddler={{$:/temp/generated-list-demo-state-$value$}}>"
#3 change row 15 to <$macrocall $name="ttt" value=<<TestList>> >

sini-Kit

unread,
Mar 4, 2016, 10:55:07 PM3/4/16
to TiddlyWiki
nothing  changes.  your variant don't add [[]] , so it works as mine. You can test it yourself. if title has space it don't work  
 

\define ttt(value)

<$select tiddler='$:/temp/generated-list-demo-state-$(TestList)$'>
<$list filter='345336 3453434 45645645 3453453411 [[3454356 1]] [[43547776 1 1]] [[544345 1 1]] [[5675678 1 1]] [[967875 1 1]]'>
<option value= <<currentTiddler>> ><$view field='nazvanie'/></option>
</$list>
</$select>
 <$tiddler tiddler={{$:/temp/generated-list-demo-state-$value$}}>

<$list filter=<<currentTiddler>>>  <span class="textboxtop textboxwhite ">
   {{||$:/_tile_images}}     </span>
</$list>
</$tiddler>
\end

<$set name=TestList value=<<currentTiddler>>  >
 <$macrocall $name="ttt" value=<<TestList>> >
</$set>





суббота, 5 марта 2016 г., 1:23:36 UTC+3 пользователь c pa написал:

c pa

unread,
Mar 5, 2016, 7:51:01 PM3/5/16
to TiddlyWiki

sini-Kit

unread,
Mar 5, 2016, 10:08:29 PM3/5/16
to TiddlyWiki
Thank you, c pa.   but your code don't work in a proper way. If you select something in 'Flower Display' it makes the same select in 'Buy your flowers from us' and if I clone flower tiddler, result is the same.
the next problem is if I delete 'flowerchooser' macros shows empty tiddler, but it must show "base"  flower if state tiddler not exists. I have many goods in my shop and I don't want to make states for all of them.

I was sure that it is possible to put tiddler title with [[]] from option select, for example in 'radio' variant I can do it, if I don't use $list, value can be with [[]].....

\define ttt()
<$radio  tiddler='$:/temp/generated-list-demo-state-$(TestList)$'   value="[[10517]]"> целая пицца</$radio><br>
<$radio  tiddler='$:/temp/generated-list-demo-state-$(TestList)$'   value="[[10011]]"> кусок  пиццы</$radio>
<$tiddler tiddler={{$:/temp/generated-list-demo-state-$(TestList)$}}>

<$list filter=<<currentTiddler>>>  <span class="textboxtop textboxwhite ">
   {{||$:/_tile_images}}     </span>
</$list>
</$tiddler>
\end


<$set name=TestList value=<<currentTiddler>>  >
<<ttt>>
</$set>


воскресенье, 6 марта 2016 г., 3:51:01 UTC+3 пользователь c pa написал:

c pa

unread,
Mar 6, 2016, 2:18:26 AM3/6/16
to TiddlyWiki
OK,

I see two spots in your code where you are using variables that are not local to the ttt macro. I've always had problems when I don't pass in the variables explicitly

Try calling the macro with

<$macrocall $name="ttt" listName=<<TestList>> tiddlerName=<<currentTiddler>> />

And change the macro like this so it passes in the variables and makes them local:

\define ttt(listName, tiddlerName)
<$radio  tiddler='$:/temp/generated-list-demo-state-$listName$'   value="[[10517]]"> целая пицца</$radio><br>
<$radio  tiddler='$:/temp/generated-list-demo-state-$listName$'   value="[[10011]]"> кусок  пиццы</$radio>
<$tiddler tiddler={{$:/temp/generated-list-demo-state-$listName$}}>

<$list filter="[[$tiddlerName$]]" >  <span class="textboxtop textboxwhite ">

   {{||$:/_tile_images}}     </span>
</$list>
</$tiddler>
\end
Reply all
Reply to author
Forward
0 new messages