[TW5] Tabs and transclusion

327 views
Skip to first unread message

Ulrik Stervbo

unread,
May 12, 2014, 10:44:19 AM5/12/14
to tiddl...@googlegroups.com
Hello List,

I have tiddlers which display some field-values and would like to show these tiddlers within a main tiddler using tabs.

When I the tidders directly in a tab, the field values displayed are from the 'parent' tiddler. In order to display the values form the fields in the original tiddler I need to use another tiddler and to the transclusion there. For example:

This results in no display of the field-info when in a tab in MainTiddler:
# The TestTidler with the field info
Info: {{!!info}}

# Main tiddler without the field info
<<tabs "[[TestTiddler]]">>

This results in display of the field-info in the tab in MainTiddler:
# The TestTidler with the field info
Info: {{!!info}}

# TmpTab
{{TestTidler}}

# MainTiddler without the field info
<<tabs "[[TmpTab]]">>

Is there a way around this? At the moment, I'm looking at nearly duplicating a number of tiddlers with no added information.

To remind me what information I would like to see included, I use fields in my templates - is this misuse of fields?

Thanks,
Ulrik

Jeremy Ruston

unread,
May 12, 2014, 11:00:35 AM5/12/14
to TiddlyWiki
Hi Ulrik

This results in no display of the field-info when in a tab in MainTiddler:
# The TestTidler with the field info
Info: {{!!info}}

# Main tiddler without the field info
<<tabs "[[TestTiddler]]">>

The problem here is that the <$list> widgets inside the tabs macro iterate through the variable "currentTab", and not "currentTiddler". The value of "currentTiddler" is unchanged by the tabs macro.

With the syntax {{!!info}} the title defaults to the "currentTiddler" variable.

An alternative way of achieving what you want is to use something like this:

info: <$tiddler tiddler=<<currentTab>>>{{!!info}}</$tiddler>

Here, we've wrapped the transclusion in a "tiddler" widget which sets the currentTiddler variable correctly for us.
 

This results in display of the field-info in the tab in MainTiddler:
# The TestTidler with the field info
Info: {{!!info}}

# TmpTab
{{TestTidler}}

# MainTiddler without the field info
<<tabs "[[TmpTab]]">>

This works because the transclusion in TmpTab sets the current tiddler to the target tiddler.

Best wishes

Jeremy

 

Is there a way around this? At the moment, I'm looking at nearly duplicating a number of tiddlers with no added information.

To remind me what information I would like to see included, I use fields in my templates - is this misuse of fields?

Thanks,
Ulrik

--
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 http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

Ulrik Stervbo

unread,
May 12, 2014, 1:15:02 PM5/12/14
to tiddl...@googlegroups.com
I see. Thanks for clarifying.

Cheers,
Ulrik


--
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/1H6yjmmLCCk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.

Ulrik Stervbo

unread,
May 12, 2014, 1:46:27 PM5/12/14
to tiddl...@googlegroups.com
It works really well, except...

Some of the tiddlers being transcluded have a macro to generate the path to an external file:

\define linkdataset(projectid, path, file, description)
./attachments/$projectid$/$path$/<br><a href="attachments/$projectid$/$path$/$file$">$file$</a>
\end

<$macrocall $name=linkdataset projectid = {{!!project-id}} path={{!!path}} file={{!!file-name}}/>

Inserting <$tiddler tiddler=<<currentTab>>>***</$tiddler> in either the macro or the macro call does not result in the path being visible when the tiddler is in a tab.

Is there a better way of generating a path to an external file?

Cheers,
Ulrik

Ulrik Stervbo

unread,
May 13, 2014, 2:57:54 AM5/13/14
to tiddl...@googlegroups.com
The solution is to encapsulate the macrocall in <$tiddler>:

<$tiddler tiddler=<<currentTab>>><$macrocall $name=linkdataset projectid = {{!!project-id}} path={{!!path}} file={{!!file-name}}/></$tiddler>

Cheers,
Ulrik
Reply all
Reply to author
Forward
0 new messages