Hi Jeremy

Thanks again for your help and all the support that you give to the 
community.

I was able to achieve the desired effect by putting the whole text to the 
sub-sub-tiddler into a macro definition which can then reference the global 
variable, like this;

\define section(sec)
> <$text text=$(currentChapter)$/>
> <<tabs "[tag[$(currentChapter)$]tag[$sec$]]" "Subtraction" 
> "$:/state/videotab" "tw-vertical">>
> \end


I made the template available for anybody who's interested (it doesn't do 
anything too exciting, but it lets me add chapters and sections by just 
making tiddlers and then add content to the right place in the grid with 
pairs of tags - it's very useful to me)

Thanks again

Regards,
Richard

https://dl.dropboxusercontent.com/u/83055414/booktemplate.html



On Friday, July 25, 2014 5:44:30 PM UTC+10, Jeremy Ruston wrote:
>
> 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 <[email protected] 
> <javascript:>> 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 <[email protected]
>>> > 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 [email protected].
>>>> To post to this group, send email to [email protected].
>>>>
>>>> Visit this group at http://groups.google.com/group/tiddlywiki.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> -- 
>>> Jeremy Ruston
>>> mailto:[email protected]
>>>  
>>
>
>
> -- 
> Jeremy Ruston
> mailto:[email protected] <javascript:>
>  

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

Reply via email to