Why an Attribute's value set by <<macro>> & {{!!transclusion}} doesn't wikify

131 views
Skip to first unread message

S. S.

unread,
Mar 3, 2019, 12:24:14 AM3/3/19
to TiddlyWiki

As maybe only a few might be aware, I have been proposing that macros forming a part of TiddlyWiki's core that deal with the caption field should not break down when encountering an empty caption field. The main ones that do break down, and which I feel would be exasperating for normal users of TiddlyWiki, are the Table of Content toc macros and the list-links macro.

Well as part of trying to put forward a convincing case, I have tried many variations of fixing the toc-caption macro that resides in $:/core/macros/toc

My latest endeavour is shown in this post: https://github.com/Jermolene/TiddlyWiki5/issues/3624#issuecomment-466652926
I feel it finally passes all the requirements needed. Now the main hurdle left is a decision on if this change is the wanted default behaviour.

While looking at that proposal, I started wondering why something like tiddler=<<currentTiddler>> did not break down when a Title name contained text that would normally be Wikified.

<$set name="display" tiddler=<<currentTiddler>> field="caption">

By experience I know that a WikiText macro call: <<currentTiddler>>  : wikifies the variable, but within this widget, used as the value of a attribute, it does not Wikify.

So I made a tiddler to see what things looks like:

Tiddler:
title : Tiddler 10^^2^^
caption : 10^^2^^

`display` variable has been set using:

```
<$set name="display-caption" tiddler=<<currentTiddler>> field="caption">
```

`caption` field is: <pre><$view field=caption/></pre>
<hr>
<$set name="display-caption" tiddler=<<currentTiddler>> field="caption">

`<$view field=title/>`= <$view field=title/>

`<$text text=<<currentTiddler>>/>`= <$text text=<<currentTiddler>>/>

`<<currentTiddler>>`= <<currentTiddler>>

`<<storyTiddler>>`= <<storyTiddler>>

`<<display-caption>>`= <<display-caption>>

`<$macrocall $name="currentTiddler"/
>`= <$macrocall $name="currentTiddler"/>

`
<$macrocall $name="currentTiddler" $type="text/plain" $output="text/plain"/>`= <$macrocall $name="currentTiddler" $type="text/plain" $output="text/plain"/>

`
<$macrocall $name="currentTiddler" $type="text/plain" $output="text/vnd.tiddlywiki"/>`= <$macrocall $name="currentTiddler" $type="text/plain" $output="text/vnd.tiddlywiki"/>

`
<$macrocall $name="currentTiddler" $type="text/plain"/>`= <$macrocall $name="currentTiddler" $type="text/plain"/>

`
<$macrocall $name="currentTiddler" $type="text/html"/>`= <$macrocall $name="currentTiddler" $type="text/html"/>

The last two have HTML:

```

<pre><code>Tiddler 10^^2^^</code></pre>

<iframe src="data:text/html;charset=utf-8,Tiddler%2010%5E%5E2%5E%5E" sandbox=""></iframe>

```
</$set>



Some of the results are quite interesting.

Another simple example is:

Tiddler:
title: Tiddler ^^11^^
<$link to=<<currentTiddler>>>{{!!title}}</$link>

The first "Wikitext" - <<currentTiddler>> - does not get Wikified because it is not being used in Wikitext.
The second "Wikitext" - {{!!title}} - does get Wikified beause it is in an area of Wikitext.

So, would it be correct to say that, in general when a macro or other Wikitext is used as the value of an attribute of a widget, that is NOT a case of it being used within Wikitext - so it is not Wikified?

And then, the $wikify widget is the one exception, as the widget can and does Wikify the value of its text attribute?

Note: Tiddler attached







Tiddler 10^^2^^.tid

Jeremy Ruston

unread,
Mar 3, 2019, 7:58:53 AM3/3/19
to tiddl...@googlegroups.com
Hi SS

Your title is correct: transcluded attributes are not wikified, they use the raw text of the variable or field. That’s done because wikification is slow. Meanwhile, we *do* wikify when making a freestanding transclusion.

It’s a major source of irritation to me that we have such a fundamental inconsistency, but it’s hard to fix it now.

The best I can come up with at the moment is a new shortcut where this:

<:<macroname param:foo>>

Would be  shortcut for:

<$text text=<macroname param:foo>>

And then we’d have to correct all those places where we see people using <<currentTiddler>> without realising that it will break if there is wikitext in the tiddler title...

Best wishes

Jeremy.

--
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/9a8ccdb6-cf03-4953-bfa8-3a078334d7b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<Tiddler 10^^2^^.tid>

TonyM

unread,
Mar 3, 2019, 8:26:40 AM3/3/19
to TiddlyWiki
Jeremy,

I am interested in your view.

I find catering for Wiki Text in titles a dangerous approach. After all in TiddlyWiki the tiddler is basically the primary key. The reason I find it particularly curious is we have captions, css, alternate fields and more to use it we really want titles to appear with more formatting and complexity, each of which does not cause such complexity as in your example above.

Why do you think we should proceed to permit complex and wikifyable titles?

A simple example is captions can be used to give a more appropriate title, especially in he cases of system tiddlers, I sometimes wonder why we do not have a method to display the caption or an alternate name rather than the title on opening a tiddler.It would be simple to allow the user to click or mouse over to see the true tiddler title.

I go back to my database knowledge. Where we should avoid combined keys and wonder if it is wise including display information or none primary key data in a title/key. Since the title serves such a critical role is it wise to reduce searchability etc.. buy having wikitext ritch titles?

You view point is appreciated.

Regards
Tony

Jeremy Ruston

unread,
Mar 3, 2019, 9:08:07 AM3/3/19
to tiddl...@googlegroups.com
Hi Tony

There's a misunderstanding here. I'm not recommending using wikitext within tiddler titles, I'm pointing out that there's a whole class of errors that we get when people  inadvertently do introduce wikitext markup into a title. A very common example would be to use a URL as a tiddler title; when rendered as wikitext the double slash will be interpreted as the start of a run of italics.

The way to avoid these errors is to avoid ever wikifying tiddler titles; my comment was about the frequency with which I see <<currentTiddler>> type constructions, which are the ones that will fail with inadvertent wikification.

Best wishes

TonyM

unread,
Mar 3, 2019, 3:27:33 PM3/3/19
to TiddlyWiki
Jeremy,

Thanks for the clarification.

I hope as changes come to simplify contributions to the documentation we can start to offer some of this "soft guidence" to new and expirenced users a like and save them expieriencing time wasting grief we often hear voiced in gg.

We also get to flag areas useful techniques can be used to avoid problem areas. I have a dozen ongoing subprojects to simplify variouse use cases we can expect, and see users. Trying to tackle, for example related to this thread, the ability to drag and drop or paste urls into tiddlywiki to collect and manage them.

I could go into more detail but it would be off topic.

Regards
Tony

Reply all
Reply to author
Forward
0 new messages