Hi Richard

At the moment there is no way to reference a variable value within a
filter: there is no equivalent to the construction `[tag[<$text
text=<<currentChapter>>/>]tag[Videos]]`. There is a ticket to add this
feature - https://github.com/Jermolene/TiddlyWiki5/issues/583

Until that ticket is implemented, the workaround is to take advantage of
the fact that filters can reference the "currentTiddler" variable. So, you
can do something like this:

<$set name="currentTiddler" value=<<currentChapter>>>
<<tabs "[all[current]tagging[]tag[Videos]]" "Subtraction"
"$:/state/videostab" "tw-vertical">>
</$set>

The "tagging" operator returns all the tiddlers that are tagged by the
current tiddler.

The problem with assigning to currentTiddler is that you may also need to
access the current tiddler within one of your tabs. You can use the set
widget to copy the currentTiddler value to another variable before you
overwrite it.

Best wishes

Jeremy



On Fri, Jul 25, 2014 at 4:14 AM, Richard Smith <
richardwilliamsmit...@gmail.com> wrote:

> Hi Jeremy and thanks
>
> I'm afraid I am still confused;
>
> <$text text=<<currentChapter>>/>
> <<tabs "[tag[<$text text=<<currentChapter>>/>]tag[Videos]]" "Subtraction"
> "$:/state/videostab" "tw-vertical">>
>
> This is my sub-sub-tiddler. The first $text works as expected and inserts
> the right chapter title but the filter expression returns an error, as does
>
> <<tabs "[tag[<<currentChapter>>]tag[Videos]]" "Subtraction"
> "$:/state/videostab" "tw-vertical">>
>
> What am I not getting?
>
> Regards,
> Richard
>
>
> On Friday, July 25, 2014 8:03:00 AM UTC+10, Jeremy Ruston wrote:
>
>> Hi Richard
>>
>> The tabs macro places the title of the current tab in the variable
>> "currentTab".
>>
>> So, in your top level tab tiddlers you can copy that variable to a new
>> variable "currentChapter" like this:
>>
>> <$set name="currentChapter" value=<<currentTab>>>
>> ...insert content of chapter tab here
>> </$set>
>>
>> Then, inside you sub-sub-tiddler you can write this to get a reference to
>> the current chapter:
>>
>> <$text text=<<currentChapter>>/>: My section name
>>
>> > I am guessing there may be a clever way to put the Chapter title into
>> a field and then use it in the filter expression but I am still struggling
>> to grok the wikitext syntax.
>>
>> You were on the right track, except that we use a variable rather than a
>> field. Tiddler field values are global across the entire wiki, while
>> variable values are assigned to specific portions of the widget render
>> tree. So, any value that needs to be different in different areas of the
>> render tree needs to be a variable.
>>
>> Best wishes
>>
>> Jeremy.
>>
>>
>>
>>
>>
>> On Thu, Jul 24, 2014 at 10:20 PM, Richard Smith <richardwil...@gmail.com>
>> wrote:
>>
>>> Suppose I have a tiddler that generates tabs from a tag.
>>>
>>> <<tabs "[tag[Chapter]]" "Chapter1" "$:/state/chapter">>
>>>
>>> And each of those tab-tiddlers also generates tabs, containing
>>> sub-sections
>>>
>>> <<tabs "[tag[Chapter1]tag[Sections]]" "VideosTab" "$:/state/section"
>>> "tw-vertical">>
>>>
>>> And each of those also generates tabs, containing individual pieces of
>>> content
>>>
>>> <<tabs "[tag[Chapter1]tag[Section1]]" "Subtraction"
>>> "$:/state/section1tid" "tw-vertical">>
>>>
>>> --
>>> Is there a way to alter the text of the bottom tiddler so that instead
>>> of "Chapter1" it contains a reference to the Chapter as selected at the top
>>> level.
>>>
>>> ie;
>>>
>>> <<tabs "[tag[ -reference- ]tag[Section1]]" "Subtraction"
>>> "$:/state/section1tid" "tw-vertical">>
>>>
>>> This would let me re-use the code at levels two and three. I have tried
>>> many combinations of magical punctuation but can't seem to find one that
>>> works.
>>>
>>> If I drop the top level of my construct and instead have a tiddler for
>>> each chapter then the transcluded content in the tabs remains in the
>>> context of each chapter, meaning that if I write {{!!title}} at the bottom
>>> level, I get the title of the correct chapter, but I can't include this in
>>> the filter expression.
>>>
>>> I am guessing there may be a clever way to put the Chapter title into a
>>> field and then use it in the filter expression but I am still struggling to
>>> grok the wikitext syntax.
>>>
>>> PS: I am very keen to help the community with efforts to better document
>>> TW - is anybody actively working on this atm?
>>>
>>> Regards,
>>> Richard
>>>
>>> --
>>> 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
>>
>


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

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to