[tw5] Re: Automatic display of field content toggled by tag

2022-09-01 Thread PMario
By the way. 
Most of the discussion is going on at: https://talk.tiddlywiki.org/ now. 
... Just to let you know. 
-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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/74c3e310-9670-4d29-b620-3575b88ee79fn%40googlegroups.com.


[tw5] Re: Automatic display of field content toggled by tag

2022-09-01 Thread PMario
On Thursday, September 1, 2022 at 10:24:26 AM UTC+2 ma...@oliverhahn.net 
wrote:
..

> May I just add one remark to a small weakness of your code, just in case 
> some other person would like to use that feature. 
>

That was intentional, to test your participation :)) ... 


... just joking 
 

> 
> I solved that with adding another complementary list filter in 
> :/my/tabs/header/template. The template now looks like:
>
> ```
> <$list filter="[tag[info]]">
> <$tiddler tiddler=<> >
> <$transclude tiddler=":/my/body/header/template" mode="block"/>
> 
> 
> <$list filter="[!tag[info]]">
> <$tiddler tiddler=<> >
> <$transclude tiddler="$:/core/ui/ViewTemplate/body/default" mode="block"/>
> 
> 
> ```
>

There would be a different way with a more complex filter construction. But 
I think "keep it simple .." wins here. It's probably more flexible in the 
future. 

well done ;)
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/1ec86c99-c870-4fce-b506-b77d6c508f15n%40googlegroups.com.


[tw5] Re: Automatic display of field content toggled by tag

2022-09-01 Thread ma...@oliverhahn.net
Hello PMario!

Thank you so very much for your solution! It's wonderful and fits now 
exactly the belongings of my organisation. I am very taken with your 
dedication and patience. And thanks especially for that 
$:/tags/ViewTemplateBodyFilter trick I didn't know before, it's that cool 
way I was looking for. 

May I just add one remark to a small weakness of your code, just in case 
some other person would like to use that feature. 

The list filter in :/my/tabs/header/template works only if the tag info is 
set. That leads to the effect that a tiddler without the info tag is not 
displayed in tab view at all. You can check that in your example with 
removing the info tag from the SampleTabOne tiddler and watching the result 
in test-tabs tiddler. I solved that with adding another complementary list 
filter in :/my/tabs/header/template. The template now looks like:

```
<$list filter="[tag[info]]">
<$tiddler tiddler=<> >
<$transclude tiddler=":/my/body/header/template" mode="block"/>


<$list filter="[!tag[info]]">
<$tiddler tiddler=<> >
<$transclude tiddler="$:/core/ui/ViewTemplate/body/default" mode="block"/>


```

So our demand is solved, thanks again for your help.

Greetings!

Oliver


PMario schrieb am Mittwoch, 31. August 2022 um 22:22:56 UTC+2:

> Your request is OK. I think I could figure it out ;) 
>
> General rule: 
>
> Please describe the requested result in plain text or create some 
> screenshots with normal wikitext, but without the templates ... Sometimes 
> it's possible to create a "mockup" with standard wikitext 
>
> If we only get broken code or code that doesn't do what you want, it's 
> very hard for us to imagine, what you wanted, with code alone. The plain 
> text helps much more. .. 
>
> On Wednesday, August 31, 2022 at 4:05:09 PM UTC+2 ma...@oliverhahn.net 
> wrote:
> ...
>
>> It is not seen in tab view. I am aware that manipulating the common 
>> ViewTemplate is a quite brutal way. 
>>
> Part of my $:/core/ui/ViewTemplate:
>>
>
> It shouldn't be needed to manipulate the ViewTemplate. .. There are 
> several mechanisms in place that allow us to avoid that. 
>
> My response below addresses the following paragraph only. 
>
> >But after all this solution does sadly not address my whole problem. With 
> this tabs-template-solution the definded field content of a tiddler is 
> shown in tabs view, but not in the standard tiddler view. I was looking for 
> a solution which shows the field content in both views. 
>
> My very first solution used the ViewTemplate cascade, but it only worked 
> with the tiddler and not with tabs. 
> Infos of the active cascade can be found at: 
>
> ControlPanel -> Info -> Advanced 
> -> Cascades -> View Template Body ... tab
>
> I assume you want something like this: 
>
> [image: body-header.png]
>
> There are 3 template elements needed. ... 
>
> *1st tiddler:*
>
> Title -> `:/config/enable/body/header` tagged: `$:/
> tags/ViewTemplateBodyFilter` ... 
> It's responsible to enable the header in the standard tiddler body. .. As 
> the name suggests ;) The ViewTemplate is dynamically configured. 
>
> *Important:* It needs a `list-before` field with the value 
> `$:/config/ViewTemplateBodyFilters/default`
>
> The content is a filter expression, that needs to return the name of the 
> body-template. I used `:/my/body/header/template` here in the example. If 
> you use it like this it's a standard tiddler. But if you add a $ as the 
> first character, it will be system tiddler and will not show up for your 
> users. 
>
> System tiddlers can be found in the right sidebar -> More -> System .. or 
> with AdvancedSearch -> System tab
>
> ```
> title: :/config/enable/body/header 
> tags: $:/tags/ViewTemplateBodyFilter 
> list-before: $:/config/ViewTemplateBodyFilters/default
>
> [all[current]tag[info]then[:/my/body/header/template]] 
> ```
>
> *2nd tiddler: *
> `:/my/body/header/template` ... Which contains the new header code
>
> ```
> ''Revisionsstand:<$view field="Stand" format="date" template="MMM 
> "/>''
> 
> {{||$:/core/ui/ViewTemplate/body/default}}
> ```
>
> *3rd tiddler: *
> `info-tab-template` ... I did rename this one. In the finished product it 
> may be `$:/my/tabs/header/template`
> It got new code, so we can reuse the body-header-template .. so changes 
> are only needed in 1 place. 
>
> ```
> <$list filter="[tag[info]]">
> <$tiddler tiddler=<> >
> <$transclude tiddler=":/my/body/header/template" mode="block"/>
> 
> 
> ```
>
> As I wrote if your users shouldn't see that stuff, you need to make them 
> system tiddlers. They start with `$:/` ... The tiddler titles have to be 
> manually *adjusted in the code too*. 
>
> There is a ZIP file attached, that I used for testing. 
>
> 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 

[tw5] Re: Automatic display of field content toggled by tag

2022-08-31 Thread PMario
Your request is OK. I think I could figure it out ;) 

General rule: 

Please describe the requested result in plain text or create some 
screenshots with normal wikitext, but without the templates ... Sometimes 
it's possible to create a "mockup" with standard wikitext 

If we only get broken code or code that doesn't do what you want, it's very 
hard for us to imagine, what you wanted, with code alone. The plain text 
helps much more. .. 

On Wednesday, August 31, 2022 at 4:05:09 PM UTC+2 ma...@oliverhahn.net 
wrote:
...

> It is not seen in tab view. I am aware that manipulating the common 
> ViewTemplate is a quite brutal way. 
> Part of my $:/core/ui/ViewTemplate:
>

It shouldn't be needed to manipulate the ViewTemplate. .. There are several 
mechanisms in place that allow us to avoid that. 

My response below addresses the following paragraph only. 

>But after all this solution does sadly not address my whole problem. With 
this tabs-template-solution the definded field content of a tiddler is 
shown in tabs view, but not in the standard tiddler view. I was looking for 
a solution which shows the field content in both views. 

My very first solution used the ViewTemplate cascade, but it only worked 
with the tiddler and not with tabs. 
Infos of the active cascade can be found at: 

ControlPanel -> Info -> Advanced 
-> Cascades -> View Template Body ... tab

I assume you want something like this: 

[image: body-header.png]

There are 3 template elements needed. ... 

*1st tiddler:*

Title -> `:/config/enable/body/header` tagged: `$:/
tags/ViewTemplateBodyFilter` ... 
It's responsible to enable the header in the standard tiddler body. .. As 
the name suggests ;) The ViewTemplate is dynamically configured. 

*Important:* It needs a `list-before` field with the value 
`$:/config/ViewTemplateBodyFilters/default`

The content is a filter expression, that needs to return the name of the 
body-template. I used `:/my/body/header/template` here in the example. If 
you use it like this it's a standard tiddler. But if you add a $ as the 
first character, it will be system tiddler and will not show up for your 
users. 

System tiddlers can be found in the right sidebar -> More -> System .. or 
with AdvancedSearch -> System tab

```
title: :/config/enable/body/header 
tags: $:/tags/ViewTemplateBodyFilter 
list-before: $:/config/ViewTemplateBodyFilters/default

[all[current]tag[info]then[:/my/body/header/template]] 
```

*2nd tiddler: *
`:/my/body/header/template` ... Which contains the new header code

```
''Revisionsstand:<$view field="Stand" format="date" template="MMM 
"/>''

{{||$:/core/ui/ViewTemplate/body/default}}
```

*3rd tiddler: *
`info-tab-template` ... I did rename this one. In the finished product it 
may be `$:/my/tabs/header/template`
It got new code, so we can reuse the body-header-template .. so changes are 
only needed in 1 place. 

```
<$list filter="[tag[info]]">
<$tiddler tiddler=<> >
<$transclude tiddler=":/my/body/header/template" mode="block"/>


```

As I wrote if your users shouldn't see that stuff, you need to make them 
system tiddlers. They start with `$:/` ... The tiddler titles have to be 
manually *adjusted in the code too*. 

There is a ZIP file attached, that I used for testing. 

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/3fe2ebda-6612-4335-bf87-2a54118122dcn%40googlegroups.com.
<>


[tw5] Re: Automatic display of field content toggled by tag

2022-08-31 Thread springer
Oliver,

This is a quick reply; perhaps I don't fully understand your challenge. But 
it seems pmario's solution worked EXCEPT for not showing date format, yes?

If so, you should just be able to replace the transclude bit (inside 
pmario's initial list-filter, which checks for the info tag), and call the 
view widget instead, which allows you to specify format (modifying the 
template for the format to suit your needs):

```
<$view tiddler=<> field=info format=date template="DDth mmm 
 0hh:0mm:0ss" />
```

-Springer
On Wednesday, August 31, 2022 at 10:05:09 AM UTC-4 ma...@oliverhahn.net 
wrote:

> Hello mario, hello everybody!
>
> Mario, thank you very much for your detailed answer. I was able to 
> transfer your solution to my testing wiki and it works principally and I 
> understand the way it works. 
> Unfortunately my indended field is in date format. The output of the 
> described tiddler-template-solution is as an unformatted string like 
> 20220829. I could not find a way to enter working format parameters in the 
> transclude line in the template. Do you perhaps have an idea how to format 
> the output to a readable date?
>
> But after all this solution does sadly not address my whole problem. With 
> this tabs-template-solution the definded field content of a tiddler is 
> shown in tabs view, but not in the standard tiddler view. I was looking for 
> a solution which shows the field content in both views. 
>
> What I found so far is:
>
> 1. Manipulating $:/core/ui/ViewTemplate
> When I insert a $view field command in the $:/core/ui/ViewTemplate my 
> field content is shown - if existing - at the top of any tiddler in 
> standard view. Date formatting is possible, but I was not able to make this 
> tag-sensitive. It is not seen in tab view. I am aware that manipulating the 
> common ViewTemplate is a quite brutal way. 
> Part of my $:/core/ui/ViewTemplate:
>
> ```
> [is[shadow]is[tiddler]then[tc-tiddler-overridden-shadow]] 
> [is[system]then[tc-tiddler-system]] [{!!class}] 
> [tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ 
> ]] }}}>
> ''Revisionsstand:<$view field="Stand" format="date" template="MMM 
> "/>''
> 
> <$list 
> filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" 
> variable="listItem">
> <$transclude tiddler=<>/>
> ```
>
> 2. Manipulating $:/core/macros/tabs
> I inserted a $view tiddler line in $:/core/macros/tabs and my field 
> content is shown in tabs view. Again, date formatting works but I clould 
> not make it tag-sensitive. 
> Part of my $:/core/macros/tabs:
>
> ```
> <$reveal type="match" state=<> text=<> 
> default="$default$" retain="""$retain$""">
> <$transclude tiddler="$template$" mode="block">
> ''Revisionsstand:<$view tiddler=<> field="Stand" 
> format="date" template="MMM "/>''
> 
> <$transclude tiddler=<> mode="block"/>
> 
> ```
>
> 3. CSS
> I was trying to enter some content via Tiddlywiki's CSS interface, like so:
>
> ```
> .tc-tagged-info:before {
> content: "TEST";
> }
> ```
>
> This works with text, but entering html via 'content' seems to be not 
> possible by design. Dead end again. 
>
> So, a bunch of questions are still open: 
> A. Is there a more elegant way to set up my plan of date field content 
> beeing displayed in a tagged tiddler in both, the standard and the tab view?
> B. If it has to be a deep manipulation, is it possible to manipulate 
> Tiddlywiki on a single point, so that a date field content is displayed in 
> a tagged tiddler in both, the standard and the tab view?
> C. If it have to be the both points which I described in 1. and 2., can 
> these be made tag-sensitive?
>
> Thanks for your patience
> Greetings
>
> Oliver Hahn
>
>
> PMario schrieb am Dienstag, 30. August 2022 um 14:50:08 UTC+2:
>
>> Hi Oliver,
>>
>> On Monday, August 29, 2022 at 3:07:21 PM UTC+2 ma...@oliverhahn.net 
>> wrote:
>>
>>> ... This is not ideal, it really should be toggleable (by tag) and my 
>>> solution works only in the tiddler default view. But we are making 
>>> extensive use of the tabs macro in our Tiddlywiki and unfortunately the 
>>> ViewTemplate-solution doesn't work on tabs. 
>>>
>>
>> So I do understand you right, that you want the info-field, to be shown 
>> inside the tabs macro above the tiddler content. right?
>>
>> The tabs-macro allows you to use a template 
>> . So it can be called as follows. 
>> See the new "template" parameter
>>
>> ```
>> <> "SampleTabOne" "$:/state/tab1" template:"info-tiddler-template">>
>> ```
>>
>> Create a new tiddler eg:  *info-tiddler-template* with the following 
>> content: do *not* use the 3 backticks ```  ... only the text between 
>> them.
>>
>> ```
>> \whitespace trim
>>
>> <$list filter="[tag[info]">
>> <$transclude tiddler=<> field="info" />
>> 
>>
>> <$tiddler tiddler=<> >
>> <$transclude tiddler="$:/core/ui/ViewTemplate/body/default" mode="block"/>
>> 
>> ```
>>
>> Where the list-widget checks if the tiddler mentioned in the 

[tw5] Re: Automatic display of field content toggled by tag

2022-08-31 Thread ma...@oliverhahn.net
Hello mario, hello everybody!

Mario, thank you very much for your detailed answer. I was able to transfer 
your solution to my testing wiki and it works principally and I understand 
the way it works. 
Unfortunately my indended field is in date format. The output of the 
described tiddler-template-solution is as an unformatted string like 
20220829. I could not find a way to enter working format parameters in the 
transclude line in the template. Do you perhaps have an idea how to format 
the output to a readable date?

But after all this solution does sadly not address my whole problem. With 
this tabs-template-solution the definded field content of a tiddler is 
shown in tabs view, but not in the standard tiddler view. I was looking for 
a solution which shows the field content in both views. 

What I found so far is:

1. Manipulating $:/core/ui/ViewTemplate
When I insert a $view field command in the $:/core/ui/ViewTemplate my field 
content is shown - if existing - at the top of any tiddler in standard 
view. Date formatting is possible, but I was not able to make this 
tag-sensitive. It is not seen in tab view. I am aware that manipulating the 
common ViewTemplate is a quite brutal way. 
Part of my $:/core/ui/ViewTemplate:

```
[is[shadow]is[tiddler]then[tc-tiddler-overridden-shadow]] 
[is[system]then[tc-tiddler-system]] [{!!class}] 
[tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ 
]] }}}>
''Revisionsstand:<$view field="Stand" format="date" template="MMM 
"/>''

<$list 
filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" 
variable="listItem">
<$transclude tiddler=<>/>
```

2. Manipulating $:/core/macros/tabs
I inserted a $view tiddler line in $:/core/macros/tabs and my field content 
is shown in tabs view. Again, date formatting works but I clould not make 
it tag-sensitive. 
Part of my $:/core/macros/tabs:

```
<$reveal type="match" state=<> text=<> 
default="$default$" retain="""$retain$""">
<$transclude tiddler="$template$" mode="block">
''Revisionsstand:<$view tiddler=<> field="Stand" 
format="date" template="MMM "/>''

<$transclude tiddler=<> mode="block"/>

```

3. CSS
I was trying to enter some content via Tiddlywiki's CSS interface, like so:

```
.tc-tagged-info:before {
content: "TEST";
}
```

This works with text, but entering html via 'content' seems to be not 
possible by design. Dead end again. 

So, a bunch of questions are still open: 
A. Is there a more elegant way to set up my plan of date field content 
beeing displayed in a tagged tiddler in both, the standard and the tab view?
B. If it has to be a deep manipulation, is it possible to manipulate 
Tiddlywiki on a single point, so that a date field content is displayed in 
a tagged tiddler in both, the standard and the tab view?
C. If it have to be the both points which I described in 1. and 2., can 
these be made tag-sensitive?

Thanks for your patience
Greetings

Oliver Hahn


PMario schrieb am Dienstag, 30. August 2022 um 14:50:08 UTC+2:

> Hi Oliver,
>
> On Monday, August 29, 2022 at 3:07:21 PM UTC+2 ma...@oliverhahn.net wrote:
>
>> ... This is not ideal, it really should be toggleable (by tag) and my 
>> solution works only in the tiddler default view. But we are making 
>> extensive use of the tabs macro in our Tiddlywiki and unfortunately the 
>> ViewTemplate-solution doesn't work on tabs. 
>>
>
> So I do understand you right, that you want the info-field, to be shown 
> inside the tabs macro above the tiddler content. right?
>
> The tabs-macro allows you to use a template 
> . So it can be called as follows. 
> See the new "template" parameter
>
> ```
> < "SampleTabOne" "$:/state/tab1" template:"info-tiddler-template">>
> ```
>
> Create a new tiddler eg:  *info-tiddler-template* with the following 
> content: do *not* use the 3 backticks ```  ... only the text between them.
>
> ```
> \whitespace trim
>
> <$list filter="[tag[info]">
> <$transclude tiddler=<> field="info" />
> 
>
> <$tiddler tiddler=<> >
> <$transclude tiddler="$:/core/ui/ViewTemplate/body/default" mode="block"/>
> 
> ```
>
> Where the list-widget checks if the tiddler mentioned in the 
> currenTab-variable has a tag "info". If yes it shows that info using the 
> transclude-widget. 
>
> The second code block uses the default core template, that is used for the 
> tiddler body. 
>
> I did test it at tiddlywiki.com .. If it doesn't work for you just ask. 
>
> The following code adds a HTML HR .. horizontal rule, so there is a visual 
> indication that the info field is shown. .. That's just an example, so you 
> see, where you can add additional conditional info text
>
> ```
> \whitespace trim
>
> <$list filter="[tag[info]">
> <$transclude tiddler=<> field="info" />
> 
> 
>
> <$tiddler tiddler=<> >
> <$transclude tiddler="$:/core/ui/ViewTemplate/body/default" mode="block"/>
> 
> ```
>
> have fun!
> mario
>

-- 
You received this message because you are subscribed to the Google Groups 

[tw5] Re: Automatic display of field content toggled by tag

2022-08-30 Thread PMario
Hi Oliver,

On Monday, August 29, 2022 at 3:07:21 PM UTC+2 ma...@oliverhahn.net wrote:

> ... This is not ideal, it really should be toggleable (by tag) and my 
> solution works only in the tiddler default view. But we are making 
> extensive use of the tabs macro in our Tiddlywiki and unfortunately the 
> ViewTemplate-solution doesn't work on tabs. 
>

So I do understand you right, that you want the info-field, to be shown 
inside the tabs macro above the tiddler content. right?

The tabs-macro allows you to use a template 
. So it can be called as follows. See 
the new "template" parameter

```
<>
```

Create a new tiddler eg:  *info-tiddler-template* with the following 
content: do *not* use the 3 backticks ```  ... only the text between them.

```
\whitespace trim

<$list filter="[tag[info]">
<$transclude tiddler=<> field="info" />


<$tiddler tiddler=<> >
<$transclude tiddler="$:/core/ui/ViewTemplate/body/default" mode="block"/>

```

Where the list-widget checks if the tiddler mentioned in the 
currenTab-variable has a tag "info". If yes it shows that info using the 
transclude-widget. 

The second code block uses the default core template, that is used for the 
tiddler body. 

I did test it at tiddlywiki.com .. If it doesn't work for you just ask. 

The following code adds a HTML HR .. horizontal rule, so there is a visual 
indication that the info field is shown. .. That's just an example, so you 
see, where you can add additional conditional info text

```
\whitespace trim

<$list filter="[tag[info]">
<$transclude tiddler=<> field="info" />



<$tiddler tiddler=<> >
<$transclude tiddler="$:/core/ui/ViewTemplate/body/default" mode="block"/>

```

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e024fb9b-1d77-4894-93ae-80f6dba3bd9bn%40googlegroups.com.