I ran across this situation recently. I wanted tiddlers with a particular
tag to not use the default template at all. I ended up using the data-tags
styling functionality
<https://tiddlywiki.com/#Custom%20styles%20by%20data-tags> to target the
body as rendered by the standard ViewTemplate and hide it completely. In a
tiddler tagged $:/tags/Stylesheet:
div[data-tags*="MyTag"] div.tc-tiddler-body {
display: none;
}
Then I added a new template tagged $:/tags/ViewTemplate that displayed what
I wanted, and wrapped it in a list widget so it appeared only when tagged
MyTag:
<$list filter="[all[current]tag[MyTag]">
...your template here...
</$list>
You might have to play with the CSS selectors if you want something more
complicated than a single tag, but presumably you can do something similar
to that.
I'm not sure whether TiddlyWiki bothers rendering things that are behind a
display: none rule. If it does, the possibility of slightly decreased
performance might be the one drawback to this approach.
On Thursday, April 29, 2021 at 4:24:54 PM UTC-5 Stobot wrote:
> Thanks Odin - I get most of that and sounds like a promising path, but how
> do I "Hide the normal $:/core/ui/ViewTemplate/body conditionally based on
> tag" without modifying the core?
>
> On Thursday, April 29, 2021 at 4:43:00 PM UTC-4 Odin wrote:
>
>> If modifying shadow tiddlers of the core is the issue:
>> Clone the $:/core/ui/ViewTemplate/body tiddler and add your
>> modifications. Add it conditionally based on tag. Hide the normal
>> $:/core/ui/ViewTemplate/body conditionally based on tag. This way, you
>> don't modify the core tiddlers and only add your own tiddlers.
>>
>> Op donderdag 29 april 2021 om 21:56:12 UTC+2 schreef Stobot:
>>
>>> Good thought Anjar - just tested it, doesn't appear to work
>>> unfortunately... I get the "details" section above the body but expanding
>>> it doesn't do anything, and and a </$details> text showing down below -
>>> seemingly indicating that it's not finding it's <$details> match above...
>>> thanks for responding though.
>>>
>>> Any other ideas?
>>>
>>> On Thursday, April 29, 2021 at 3:41:23 PM UTC-4 Anjar wrote:
>>>
>>>> Maybe it is possible to have <$details> in one tiddler and
>>>> </$details> in another tiddler and use list-before/after to manipulate the
>>>> position of the two?
>>>>
>>>> Best,
>>>> Anders
>>>>
>>>> torsdag 29. april 2021 kl. 20:57:39 UTC+2 skrev Stobot:
>>>>
>>>>> Hello all,
>>>>>
>>>>> I'm making sure there's not a better way to do this... I want to have
>>>>> tiddlers with certain tags have their body wrapped with the <$details>
>>>>> widget to keep the tiddlers short.
>>>>>
>>>>> I know I can ADD things to the body by adding ViewTemplate tags as
>>>>> outlined:
>>>>> https://groups.google.com/g/tiddlywiki/c/Jg-nmLk-yxs/m/yGricD4sBwAJ
>>>>>
>>>>> I know that I can HIDE things in the normal ViewTemplate by using CSS
>>>>> as Eric showed:
>>>>> https://groups.google.com/g/tiddlywiki/c/K6uHR4XtJ0o/m/MNxAhRxQAgAJ
>>>>>
>>>>> But I can't see how that would help what I want to do. Instead I've
>>>>> just hacked the actual $:/core/ui/ViewTemplate/body - which I know I
>>>>> don't
>>>>> want to do...
>>>>>
>>>>> \define use-details()
>>>>> <$details summary="Notes">
>>>>> <$transclude>
>>>>>
>>>>> <$transclude tiddler="$:/language/MissingTiddler/Hint"/>
>>>>>
>>>>> </$transclude>
>>>>> </$details>
>>>>> \end
>>>>> \define no-details()
>>>>> <$transclude>
>>>>>
>>>>> <$transclude tiddler="$:/language/MissingTiddler/Hint"/>
>>>>>
>>>>> </$transclude>
>>>>> \end
>>>>>
>>>>> <$reveal tag="div" class="tc-tiddler-body" type="nomatch"
>>>>> stateTitle=<<folded-state>> text="hide" retain="yes" animate="yes">
>>>>>
>>>>> <$list filter="[all[current]!has[plugin-type]!field:hide-body[yes]]">
>>>>>
>>>>> <$list filter="[all[current]tag[Tasks]] [all[current]tag[Meetings]]
>>>>> [all[current]tag[Projects]] [all[current]tag[Debriefs]]"
>>>>> emptyMessage=<<no-details>> variable="X">
>>>>> <<use-details>>
>>>>> </$list>
>>>>>
>>>>> </$list>
>>>>>
>>>>> </$reveal>
>>>>>
>>>>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/6c997dcf-16e2-4c14-a337-3b5957f25b2dn%40googlegroups.com.