a transclusion inconcistency

74 views
Skip to first unread message

Bob Jansen

unread,
Sep 12, 2020, 8:53:51 PM9/12/20
to TiddlyWiki
I have found an inconcistency in transclusion as follows:

Main tiddler code:
<$button>
<$action-createtiddler $basetitle="$:/TLS/new-id" $overwrite="yes" />
<$action-setfield $tiddler="$:/TLS/new-id" uniqueid={{$:/TLS/uniqueid}} />
/>
Add
</$button>

:$/TLS/uniueid tiddler code:
{{$:/TLS/idcode}}{{$:/TLS/incremental}}

which displays as YB27 when the idcode is YB and the incremental is 27

in the main tiddler, if the action-setfield sets the text field, then the value inserted is the transclusion of the uniqueid tiddler, namely, YB27

if the maiin tiddler action-setfield code tries to set a field, then the field's contents after actioning the code is {{$:/TLS/idcode}}{{$:/TLS/incremental}} and not the transcluded value

Anybody else found this?

bobj

Bob Jansen

unread,
Sep 12, 2020, 9:12:12 PM9/12/20
to TiddlyWiki
I have found an answer in a question, Lost in transclusion, posted on 20 August.

Eric and Tones provide the information about transclusion and having to use the wikifi widget. Taking their example and adding the wikifi line in my main tiddler code makes things work correctly.

New main tiddler code:
<$button>
<$wikify name="theuniqueid" text={{$:/TLS/uniqueid}}>
<$action-createtiddler $basetitle="$:/TLS/new-id" $overwrite="yes" />
<$action-setfield $tiddler="$:/TLS/new-id" text={{$:/TLS/uniqueid}} uniqueid=<<theuniqueid>> />
/>
Add
</$button>


Eric Shulman

unread,
Sep 12, 2020, 10:12:54 PM9/12/20
to TiddlyWiki
On Saturday, September 12, 2020 at 6:12:12 PM UTC-7, Bob Jansen wrote:
<$button>
<$wikify name="theuniqueid" text={{$:/TLS/uniqueid}}>
<$action-createtiddler $basetitle="$:/TLS/new-id" $overwrite="yes" />
<$action-setfield $tiddler="$:/TLS/new-id" text={{$:/TLS/uniqueid}} uniqueid=<<theuniqueid>> />
</$wikify>
Add
</$button>

This can also be done without using $wikify, by using an "inline filter", like this:
<$button> Add
<$vars id={{{ [{$:/TLS/idcode}addsuffix{$:/TLS/incremental}] }}}>

<$action-createtiddler $basetitle="$:/TLS/new-id" $overwrite="yes" />
<$action-setfield $tiddler="$:/TLS/new-id" text=<<id>> uniqueid=<<id>> />
</$vars>
</$button>

-e

Bob Jansen

unread,
Sep 12, 2020, 10:43:14 PM9/12/20
to tiddl...@googlegroups.com
Thanks Eric. By the way, where do all those brackets come from in the inline filter and where is all that documented when to use which and how many ?

Bobj

Dr. Bob Jansen
122 Cameron St, Rockdale NSW 2216, Australia
Skype: bobjtls

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/8OIdMGfIV-A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/f856baf6-18a7-41e0-a1d6-da474f7e1cd3o%40googlegroups.com.

TW Tones

unread,
Sep 12, 2020, 10:46:20 PM9/12/20
to TiddlyWiki
Bob

Its wise also close the Wikify widget </$wikify>

Tones

TW Tones

unread,
Sep 12, 2020, 10:56:42 PM9/12/20
to TiddlyWiki
Bob,

The Triple braces is documented but not very well. I will locate it if I can, but basically it can contain any filter who result is used where it is defined. 

When being used for maths and single values is very useful. 
{{{ filter }}}

however another form is also possible; for example in a macro apply a template for each item.
{{{ $(varnam)$ ||$:/core/templates/plain-text-tiddler}}}

Regards
Tony
To unsubscribe from this group and all its topics, send an email to tiddl...@googlegroups.com.

TW Tones

unread,
Sep 12, 2020, 11:06:25 PM9/12/20
to TiddlyWiki

Regards
Tony

On Sunday, 13 September 2020 12:43:14 UTC+10, Bob Jansen wrote:
To unsubscribe from this group and all its topics, send an email to tiddl...@googlegroups.com.

Bob Jansen

unread,
Sep 13, 2020, 8:12:06 PM9/13/20
to TiddlyWiki
Eric & Tones,

I do not know how to close the wikify tags as Tones has recommended. I have two tags as there are two variables I need.

Code:
<$wikify name="theuniqueid" text={{$:/TLS/uniqueid}}>
<$wikify name="theartworkurl" text={{$:/TLS/artworkurl}}>

''Artwork unique ID: <<theuniqueid>>''

Artwork title: <$edit-text tiddler="$:/TLS/new-title" tag="input" default=""/>

Type: <$edit-text tiddler="$:/TLS/artwork-type" tag="input" default=""/>

Medium: <$edit-text tiddler="$:/TLS/medium" tag="input" default=""/>

Size: <$edit-text tiddler="$:/TLS/size" tag="input" default=""/>

Year created: <$edit-text tiddler="$:/TLS/year-created" tag="input" default=""/>

Number in edition: <$edit-text tiddler="$:/TLS/number-in-edition" tag="input" default=""/>

Submitted to exhibition: <$edit-text tiddler="$:/TLS/artwork-submitted-to-exhibition" tag="input" default=""/>

---

Purchased by: <$edit-text tiddler="$:/TLS/purchased-by" tag="input" default=""/>

Date purchased: <$edit-text tiddler="$:/TLS/date-purchased" tag="input" default=""/>

Price: <$edit-text tiddler="$:/TLS/price" tag="input" default=""/>

Status: <$edit-text tiddler="$:/TLS/status" tag="input" default=""/>

<$button>
<$action-setfield $tiddler="$:/TLS/incremental" text={{{ [{$:/TLS/incremental}add[1]] }}}/>
<$action-createtiddler 
     $basetitle={{$:/TLS/new-title}} 
     $template="Artwork Template" 
     tags="Artworks" 
     $overwrite="yes" 
     artwork_id=<<theuniqueid>>
     artwork_url=<<theartworkurl>> 
     artwork_numberinedition={{$:/TLS/number-in-edition}} 
     artwork_price={{$:/TLS/price}} 
     artwork_status={{$:/TLS/status}} 
     artwork_yearofcreation={{$:/TLS/year-created}} 
     purchased_by={{$:/TLS/purchased-by}} 
     artwork_medium={{$:/TLS/medium}} 
     artwork_size={{$:/TLS/size}} 
     artwork_price={{$:/TLS/price}} 
     artwork_status={{$:/TLS/status}} 
     date_purchased={{$:/TLS/date-purchased}}
     artwork_type={{$:/TLS/artwork-type}}
     artwork_submitted_to_exhibition={{$:/TLS/artwork-submitted-to-exhibition}}
/>
<$action-deletetiddler $tiddler="$:/TLS/new-title" />
<$action-deletetiddler $tiddler="$:/TLS/medium" />
<$action-deletetiddler $tiddler="$:/TLS/size" />
<$action-deletetiddler $tiddler="$:/TLS/year-created" />
<$action-deletetiddler $tiddler="$:/TLS/number-in-edition" />
<$action-deletetiddler $tiddler="$:/TLS/purchased-by" />
<$action-deletetiddler $tiddler="$:/TLS/date-purchased" />
<$action-deletetiddler $tiddler="$:/TLS/price" />
<$action-deletetiddler $tiddler="$:/TLS/status" />
<$action-deletetiddler $tiddler="$:/TLS/artwork-type" />
<$action-deletetiddler $tiddler="$:/TLS/artwork-submitted-to-exhibition" />
Add new artwork
</$button>

If I add </wikify></wikify> as the last line of the code then the display of the tiddler changes to

Add New artwork </wikify></wikify>

If I leave out the </wikify> then the display looks as it should and the code does work.

What should I do?

bobj

Eric Shulman

unread,
Sep 13, 2020, 8:58:50 PM9/13/20
to tiddl...@googlegroups.com
On Sunday, September 13, 2020 at 5:12:06 PM UTC-7, Bob Jansen wrote:
Eric & Tones,
I do not know how to close the wikify tags as Tones has recommended. I have two tags as there are two variables I need.

Code:
<$wikify name="theuniqueid" text={{$:/TLS/uniqueid}}>
<$wikify name="theartworkurl" text={{$:/TLS/artworkurl}}>
...
If I add </wikify></wikify> as the last line of the code then the display of the tiddler changes to
Add New artwork </wikify></wikify>

You've left out the "$" in the close widget!  Thus:
</$wikify></$wikify>
 
If I leave out the </wikify> then the display looks as it should and the code does work.

This is a convenient side-effect of reaching the end of the tiddler definition.  Any unclosed widgets are *automatically* assumed to end when there's no more tiddler content.
Thus, for this specific use-case, leaving off the </$wikify></$wikify> "looks as it should and the code does work".

Note that the "unclosed widget" handling also applies to the end of macro definitions even when they are not the end of the tiddler definition.  Thus, if I write:

\define someMacro()
<$vars v1="..." >
<$vars v2="..." >
<$vars v3="..." >
... rest of macro here ...
</$vars></$vars></$vars>
\end
...more tiddler content here...

I can simply omit the close </$vars></$vars></$vars> inside the macro and everything is still happy.  Strictly speaking, this is not "proper" syntax, since every widget is meant have a matching "close widget" or at least use the 'shortform' where the widget itself ends with "/>" (as in <$action-setfield .... />).  Nonetheless, in some situations it can be VERY convenient to omit the closing widgets.

For example, in http://tiddlytools.com/timer.html#TiddlyTools%2FTimer%2FClocks, the clock_adjustForTimezone() macro starts with **34** lines of <$vars> and <$set> widgets that do a series of complex calculations and assignments followed by just two lines containing matched <$list>...</$list> widgets.  It would be ridiculously inconvenient to then have to include another 34 lines of matching </$set> and </$vars> at the end of the macro definition.

Note: This "omit the matching </$widget>" technique only works when the opening widgets are in the outermost level of the macro syntax.  For example, if I have some code like this:
\define someMacro()
<$vars v1="...">
<$reveal ...>
   
<$vars v2="..."
   
... something here ...
   
</$vars>
</
$reveal>
... some more stuff here ...
\end

I *must* have a </$vars> *inside* the <$reveal>...</$reveal> to match the opening <$vars v2="...">, since it isn't at the end of the entire macro.  However, I *can* still omit the </$vars> that would match the *first* <$vars v1="...">, since that *is* at the end of the macro.  In general, I recommend using proper "close widget" syntax most of the time, except for some of the specific instances I've just described.  This avoids any headaches that can occur if you happen to add just one extra line of code at the end of a macro, only to find that all your previously unclosed widgets now need to be properly matched.

I hope this all makes sense to you and doesn't confuse things even more!

-e

Dr. Bob Jansen

unread,
Sep 13, 2020, 9:54:09 PM9/13/20
to tiddl...@googlegroups.com
Eric,

thanks for your reply and it does make sense. However, as an old-timer
XML guy, leaving out the close tags is 'difficult'. Also it makes for an
exception and I abhore exceptions to markups cause experience shows
exceptions breed exceptions which in turn breed........

A final comment, the documentation of TiddlyWiki is all over the place.
As a newbie, I find it difficult to find answers to my issues. The
examples don't always make sense especially those that are coded to a
macro, like <<.operator-example 1 "[[23]add[19]]">> in the Add Examples
tiddler. This does not help me work out the syntax or use of an item.
The writer assumes the reader is familiar with things and is looking for
a refresh. Where does one look for the .operator-example tiddler, search
doesn't find it?

This is especially true for documentation about filters. From what I
have gleaned so far, filters are the concept that makes things work and
as such an important central concept that I would expect similarly sized
and detailed documentation with lots and lots of examples.

I am not trying to be negative but positive, for future newbies

bobj

--
--------------------------------
Dr Bob Jansen
122 Cameron St, Rockdale NSW 2216, Australia
Ph (Korea): +82 10-4494-0328
Ph (Australia) +61 414 297 448
Resume: http://au.linkedin.com/in/bobjan
Skype: bobjtls
KakaoTalk: bobjtls
http://cultconv.com

In line with the Australian anti-spam legislation, if you wish to receive no further email from me, please send me an email with the subject "No Spam"

TW Tones

unread,
Sep 13, 2020, 10:10:30 PM9/13/20
to TiddlyWiki
Bob,

When reading the documentation on tiddlywiki.com the intention is for the content to be displayed in the view template.

Editing the tiddler exposed the documentation macros 

<<.operator-example 1 "[[23]add[19]]">>

This is calling the .operator-example and is not itself documented for the reader.

As a community we are always looking for help enhancing the documentation, but a lot of members have documented a lot elsewhere. It is quite easy to submit simple documentation updates on tiddlywiki.com if you have a github account.

As for filters the information is all there, technically, and yes not in one place, but the application and extensibility means further documentation is necessary to empower users. There are many resources around. Most recent is some of Mohammad's work, look for his library of plugins, the first port of call is possibly the community links on tiddlywiki.com and Davids TiddlyWiki Toolmap 

Yes, we have a distance to go, but fast innovation can cause a drag in documentation.

Regards
Tony
Reply all
Reply to author
Forward
0 new messages