Tree Widget with currentTiddler?

314 views
Skip to first unread message

Alex Hough

unread,
Sep 15, 2017, 2:57:02 AM9/15/17
to TiddlyWiki
HelloThere,

I have wikify widget (kind of copied from Thomas):

<$wikify name="wikifyTest" text="<<currentTiddler>>/data">

<$edit-text 
tag="input" 
type="range" 
tiddler=<<wikifyTest>> 
index="percentage" 
placeholder="66" size="5"/> 
<$transclude tiddler=<<wikifyTest>> index="percentage"/><$link to=<<wikifyTest>>>% engaged</$link>


</$wikify>


I have this tagged so that it ends up in the view template.

I would like to do something similar with the TreeWidget, only this doesn't work:

<<tree  prefix:"<<currentTiddler>>">>

What's the best way of getting currentTiddler into the treee macro?

best wishes

Alex

Jeremy Ruston

unread,
Sep 15, 2017, 3:36:07 AM9/15/17
to tiddl...@googlegroups.com
Hi Alex

I have wikify widget (kind of copied from Thomas):
<$wikify name="wikifyTest" text="<<currentTiddler>>/data">

snip

</$wikify>

In fact, you don’t need the wikify widget here. It’s purpose is to apply wikification to the text that is passed to it, and then return the text content (ie ignoring any html tags).

So, if you pass “//italics//“ then you’ll get back the string “italics”. That means that your code will not produce the expected results whenever the tiddler title contains anything that could be wikified.

The classic solution here is to use a macro: their purpose is to permit this kind of textual subsitution.

However, there is now another way that can be convenient:

<$set name="wikifyTest" value={{{ [<currentTiddler>addsuffix[/data]] }}}>


<$edit-text 
tag="input" 
type="range" 
tiddler=<<wikifyTest>> 
index="percentage" 
placeholder="66" size="5"/> 
<$transclude tiddler=<<wikifyTest>> index="percentage"/><$link to=<<wikifyTest>>>% engaged</$link>


</$wikify>

Here, we’re using the plain old set widget with the new triple brace syntax for the “value” attribute. It parses the attribute as a filter, and then returns the first item as the resulting value for the attribute.

<<tree  prefix:"<<currentTiddler>>”>>

The simple double angle bracket syntax for invoking macros only allows plain text values to be specified for parameters.

To use transcluded attribute values you need to move up to using the underlying macrocall widget directly:

<$macrocall $name="tree" prefix=<<currentTiddler>>/>

Best wishes

Jeremy.



What's the best way of getting currentTiddler into the treee macro?

best wishes

Alex

--
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 post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/CALc1hYcwUBm2YvE3f5LVTNJqi8_dnQZFrz%2BqUBaP0V%3DGoSoB-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

PMario

unread,
Sep 15, 2017, 5:02:11 AM9/15/17
to TiddlyWiki
On Friday, September 15, 2017 at 9:36:07 AM UTC+2, Jeremy Ruston wrote:
However, there is now another way that can be convenient:

<$set name="wikifyTest" value={{{ [<currentTiddler>addsuffix[/data]] }}}>

IMO the performance of this filter depends on the number of tiddlers. ...

While parsing the following code has a constant performance.

\define xx(suffix)
$
(currentTiddler)$$suffix$
\end

<$set name="wikifyTest" value=<<xx "/data">> >
<<wikifyTest>>
</$set>


 just some thoughts.

-mario

Alex Hough

unread,
Sep 15, 2017, 6:54:58 AM9/15/17
to TiddlyWiki
Dear Jeremy and Mario,

Many thanks for the help.

I have put them in a pre-release (attached) with a view that the value of the answers to me could be shared.

I've tried to write in accordance to the style guide and link to  and use content in the existing pre-release.

I thought it might be useful to include a polished version in a pre-release.... any comments?

Best Wishes


Alex

--
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+unsubscribe@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
Textual-substitution-with-a-macro.html

Jeremy Ruston

unread,
Sep 15, 2017, 6:58:20 AM9/15/17
to tiddl...@googlegroups.com
Hi Mario

> IMO the performance of this filter depends on the number of tiddlers. ...

That particular filter doesn’t involve looping through all tiddlers; it just makes a new list with the specified title, and then processes that single title.

Best wishes

Jeremy.

Jeremy Ruston

unread,
Sep 15, 2017, 7:02:05 AM9/15/17
to tiddl...@googlegroups.com
Hi Alex

Thank you!

The tiddlers in the attached wiki are pretty specific to the question in the form that you posed it here on the group (eg the reference to the “tree” macro, when in fact the technique is independent of the macro being called).

It might be better to try to improve the existing general docs. In this case, the tiddler "Macro Calls in WikiText” contains the material on how to invoke macros, including the point about getting more flexibility by using the macrocall widget directly.

So perhaps what’s needed is some examples to flesh out this tiddler?

Best wishes

Jeremy.



To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

For more options, visit https://groups.google.com/d/optout.
<Textual-substitution-with-a-macro.html>

Alex Hough

unread,
Sep 15, 2017, 7:42:59 AM9/15/17
to TiddlyWiki
Hi Jeremy,

I think there is something around non-linear learning here. And TW is ideally suited to this. I especially like using a pre-release to play about with.

The "difficult-to-get" bits of a domain for a learner are obvious to the master.

I read something on the WEF website [1]. It mentions cognitive flexibility...

Learning things via different routes is the key to cognitive flexibility (as i understand it)

Here my "learning journey" (a dreadful term) starts with copying and adapting. Then I ran into a problem which exposed some misunderstandings and lack of knowledge of the nuances of some of the basics.

Sometimes I try to get around problems knowing that there is something to learn. The difficulties arise when the categories famously classed as "unknown unknows".

Learning with a pre-release TW -- when you link and tag, and cut-and-paste bits of pre-existing text -- can help non-linear learning. 

!! Adventure Playground of Hypertext?

"An alternative educational approach informed by cognitive flexibility is hypertext" -- https://en.wikipedia.org/wiki/Cognitive_flexibility



A tweet sparked an ananolgy via Pattern Languages. 

A messy pre-release -- "an Adventure Playground [2] of Hypertext" -- is how I use the pre-releases. I know I can get one at any time, play about and nothing is going to get damaged. All the materials and documentation is there. All the answers are within! The joy of the self contained!




Alex


To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/CALc1hYfb1EKAOrLJCQUZsrC2hy6gc%2BYutR7iiBehKnOo6Je2Ew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
<Textual-substitution-with-a-macro.html>

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
Reply all
Reply to author
Forward
0 new messages