[tw] Re: My Transclusion headache

2017-07-17 Thread PMario
Tobi Beer has some nice examples: 
http://tobibeer.github.io/tb5/#Templates:Templates%20%5B%5BConditional%20ViewTemplate%20Section%5D%5D
 
about templates. 

-m

-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/c858a60f-0c2f-4372-9428-56d354c8a4d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: My Transclusion headache

2017-07-17 Thread PMario
Hi Tony, 

It's all relatively straight forward. .. I think I know, what causes your 
headaches. 

The fact, that you can't do  $(var)${{!!field}} .. It needs to be 
$(var)$$(secondVar)$ ... to work

The fact, that the list-widget modifies the currentTiddler by default. ... 
BUT there is a "variable" parameter, which is very handy, but definitely 
"underused" by new users. 

I did add an attachment, that you can analyze. 

 - It contains a stylesheet tiddler, to customize the buttons. and 
 - a new-set-template template, that is automatically activated, when a 
tiddler has a "tab-list" field. 
 - The buttons are hidden, if the tab-tiddler contains some text! .. So if 
the tiddler exists, but is empty, the button will be visible. 

have fun!
mario

-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/4ee4bc35-d750-4be0-b217-c1568c42affc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


new-set-template-example.json
Description: application/json


[tw] Re: My Transclusion headache

2017-07-16 Thread PMario
On Monday, July 17, 2017 at 3:46:07 AM UTC+2, TonyM wrote:
>
> Where I start to have difficulties is when I try to use values in widgets, 
> macros etc...
>

I see.
 

> My particular application uses a field in outer with multiple named 
> tiddlers (Like a tags field)
> eg tiddlerlist: "Overview examples [[How to]]"
> We could call this a list of suffixes
>

ok
 

> I want to create a new tiddler button (when viewing outer) for tiddlers 
> prefixed by outers (title), suffixed by each value
> eg
> outer - Overview
> outer - examples
> outer - How To
>

:) Yea ... this is a macro uses variables problem. ... can't be solved with 
transclusions, ...
 

> The new tiddlers must also be tagged with "outer" their sufix eg Overview 
> and have their field caption set to their suffix value
>

that should be straight forward.
 

> Idealy you will not see the new tiddler button if the tiddler already 
> exists  
>

should be possible. 
 

> I am sure what you have told me will get me there eventualy.
>

yes. ... but still some work needed. 

I should have some more pointers ... soon. 

-m

-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/1e53b0fc-09af-49d3-92fa-29bdfe68c7cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: My Transclusion headache

2017-07-16 Thread TonyM
P.S.

The line above

<$importvariables filter="outer">

I want to have passed the name outer to inner

Thanks
Tony

On Sunday, July 16, 2017 at 10:59:47 PM UTC+10, PMario wrote:
>
>  
>
>> including macros etc... I want to pass a value to subsequent lists etc... 
>> that is not reevaluated in every other tiddler/macro/filter etc...
>>
>
> Once upon a time, there where no global macros. 
> Macros could only live within the tiddler where they have been defined.
> Users felt great pain. They endlessly complained about of their misery. 
> So a brave hero had to be sent out to defend the dragon ... 
> uups ... ok ok ... 
>
> Since beta 5.0.13 
> 
>  
> we have the import-variables widget. 
>
> *outer: *
>
> \define my-macro() Praise the hero!
>
> <$set name="var-test" value="asdf">
>   <$transclude tiddler="inner" mode=block/>
> 
>
>
> *inner: *
>
> <$importvariables filter="outer">
>
> <>
>
> 
>
> {{!!primary-field}}
>
> <>
>
> hope that helps :)  ... use with care!
> and
>
> have fun!
> mario
>
>

-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/05eeb2de-0e99-429d-afe1-2a38fae91f02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: My Transclusion headache

2017-07-16 Thread TonyM
Thanks Mario,

I will do my best to understand the consequences of the above.

Where I start to have difficulties is when I try to use values in widgets, 
macros etc...

I do not expect you to solve my problem but here is my chalenge.

My particular application uses a field in outer with multiple named 
tiddlers (Like a tags field)
eg tiddlerlist: "Overview examples [[How to]]"
We could call this a list of suffixes

I want to create a new tiddler button (when viewing outer) for tiddlers 
prefixed by outers (title), suffixed by each value
eg
outer - Overview
outer - examples
outer - How To

The new tiddlers must also be tagged with "outer" their sufix eg Overview 
and have their field caption set to their suffix value

Idealy you will not see the new tiddler button if the tiddler already 
exists  

I then have a nice tabs command which only displays tabs of tiddlers with 
the suffix if they exist

@@.tabsstyle

<>

@@

This will allow me to create tiddlers using outer as a template, which will 
provide optional tabs and subtiddlers in the tiddler accordiong to the 
values in tiddler list. Examples may include
Work Instructions
Code Snipits


The truth is it is currently beyond my skill level, but I see great 
potential.

I am sure what you have told me will get me there eventualy.

Regards
Tony



On Sunday, July 16, 2017 at 10:59:47 PM UTC+10, PMario wrote:
>
>  
>
>> including macros etc... I want to pass a value to subsequent lists etc... 
>> that is not reevaluated in every other tiddler/macro/filter etc...
>>
>
> Once upon a time, there where no global macros. 
> Macros could only live within the tiddler where they have been defined.
> Users felt great pain. They endlessly complained about of their misery. 
> So a brave hero had to be sent out to defend the dragon ... 
> uups ... ok ok ... 
>
> Since beta 5.0.13 
> 
>  
> we have the import-variables widget. 
>
> *outer: *
>
> \define my-macro() Praise the hero!
>
> <$set name="var-test" value="asdf">
>   <$transclude tiddler="inner" mode=block/>
> 
>
>
> *inner: *
>
> <$importvariables filter="outer">
>
> <>
>
> 
>
> {{!!primary-field}}
>
> <>
>
> hope that helps :)  ... use with care!
> and
>
> have fun!
> mario
>
>

-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/66612b76-c37d-417f-ad8d-d0a493ae6f5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: My Transclusion headache

2017-07-16 Thread PMario
 

> including macros etc... I want to pass a value to subsequent lists etc... 
> that is not reevaluated in every other tiddler/macro/filter etc...
>

Once upon a time, there where no global macros. 
Macros could only live within the tiddler where they have been defined.
Users felt great pain. They endlessly complained about of their misery. 
So a brave hero had to be sent out to defend the dragon ... 
uups ... ok ok ... 

Since beta 5.0.13 

 
we have the import-variables widget. 

*outer: *

\define my-macro() Praise the hero!

<$set name="var-test" value="asdf">
  <$transclude tiddler="inner" mode=block/>



*inner: *

<$importvariables filter="outer">

<>



{{!!primary-field}}

<>

hope that helps :)  ... use with care!
and

have fun!
mario

-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/6cde77df-6af4-48ea-9a83-aee27ecf85d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: My Transclusion headache

2017-07-16 Thread PMario
 
>
> how can I construct a variable, that once set in the primary tiddler will 
> retain its value in all subsequently transcluded tiddlers,
>

In TW variables have a scope. ... That means they are only valid inside 
there scope. 

Simple test: If you copy paste the following snippet into an empty tiddler 

<>
<$set name="var-test" value="asdf">
  <>

<>

Transclusions, that want to work with variables set in a tiddler, have to 
be called inside the "scope" of the corresponding widget. See the 
"set-widget" example form above. 

outer: 

<$set name="var-test" value="asdf">
  <$transclude tiddler="inner"/>


inner: 

<>


The same mechanisms are used by the core templates. ... They are just a bit 
more "advanced" ;)


part 2 ... one more to follow

have fun!
mario 

-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/febc355e-0f4c-4a09-bb0c-55a7bb28301d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: My Transclusion headache

2017-07-16 Thread PMario
Hi Tony,

I think, you are mixing up fundamentally different things (fields, 
variables and macros), and that gives you a headache. I'll try to point you 
into the right directions.

On Sunday, July 16, 2017 at 4:18:03 AM UTC+2, TonyM wrote:

> Using field values in my primary tiddler,
>

Fields are an integral part of the tiddler. So whenever you access eg: 
HelloThere all the fields that are defined with it, are also there. Fields 
always live in the context of the current tiddler. 

eg:
HelloThere has a "list-field" ... You can access this field from everywhere 
with {{HelloThere!!list}}

If you want to transclude the "text-field" you can use {{HelloThere!!text}}

Because we are lazy folks, we don't want to type too much there is a 
convenient function built in to TiddlyWiki: "whenever a transclusion is 
specified, the text field is used as the default field value 
." So we can write: {{HelloThere}} 
if we want the content. 

Sometimes we don't want to specify the tiddler title, because it should be 
dynamic. So we want to use: {{!!list}}. TW has a problem now. The tiddler 
title is not defined anymore. ... That's why a sensible default is used: 
The  <> variable. This currentTiddler variable is set by 
the ViewTemplate 
,
 
with the tiddler widget 
.
 


The transclude-widget uses the currentTiddler variable, but doesn't set it! 
That's important

Let's create 2 test tiddlers: *outer* and *inner*. Where outer is the 
primary tiddler, that transcludes the inner tiddler. The inner tiddler 
want's to access the primary-field ... That's what you want. right?

*outer*   defines a field eg: primary-field: PRIMARY
outer:text

outer: {{!!primary-field}}

inner: {{inner}}


-
*inner *

{{!!primary-field}}



This doesn't work, because {{inner}} sets the currenTiddler variable to 
"inner". So we need to change outer to:

*outer:* 

inner: {{||inner}}
or
inner: <$transclude tiddler=inner/>

So the currentTiddler variable isn't changed and the inner tiddler sees the 
primary-field. We call this mechanism "Transcludion with Templates 
"
 
 inner is a template now. 

... part 1  more to follow

hope that helps a bit
have fun!
mario

-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/d04487a9-f8f1-4b22-97d2-8a079ca0724a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.