Matthew

As In my post I just nominate another field object-type.

Regards
Tony

On Saturday, April 25, 2020 at 6:17:31 AM UTC+10, Matthew Lauber wrote:
>
> I'm late, but I actually implemented a generic custom edit template tool 
> this for my D&D CreatureManager Plugin here: 
> https://github.com/mklauber/tw-CreatureManager/tree/master
> basically, editTemplate chooses a EditTemplate based the "type" field of 
> the tiddler, falling back to a "default" version that handles the current 
> implementation.  Anything that wants it's own edit template, just needs to 
> choose a "Type" value, then create a tiddler named: 
> $:/core/ui/EditTemplate/{Type}
>
> I'd love a way to do that kind of thing without overriding core tiddlers, 
> and also a similar system for ViewTemplates based on "type".
>
> That said, I'm open to the idea that "type" isn't the right field, if 
> other people have different thoughts.  
>
> Matt Lauber
>
> On Wednesday, April 8, 2020 at 9:58:52 AM UTC-4, PMario wrote:
>>
>> On Tuesday, April 7, 2020 at 10:19:33 PM UTC+2, Mat wrote:
>>>
>>> tags: $:/tags/ViewTemplate
>>> text:
>>> <$list filter="[all[current]tag[Foo]]">
>>> ...
>>>
>>>
>>> Such "conditional viewtemplates" are cool but I have a feeling they can 
>>> be very inefficient in that such custom templates often only get positive 
>>> hits for *very few* tiddlers. (Is my reasoning flawed?)
>>>
>>
>> I'm not sure, if I understand the question right. .. It will *always hit* 
>> for tiddlers tagged: Foo in your example. 
>>
>> Is there instead a *targeted* way to control which viewtemplates the 
>>> *current* tiddler shows? 
>>>
>>> For example, is there some pragma that, for current, can command "show 
>>> fields *a *and* b* but not the *text* field nor the *tags*"?
>>>
>>
>> This is a completely different thing. The above code will just add 
>> something like a "footer" to the ViewTemplate. All elements taged 
>> $:/tags/ViewTemplate are visible _plus_ the new component.
>>
>> Showing a different ViewTemplate could be done by using a new field. BUT 
>> .. It would need new core code to support it. 
>>
>> We can't use the type field, since this is responsible to define the 
>> parser, that should be used for the wikitext. ... 
>>
>> At the moment the list-widget is responsible for the view-template that 
>> is used. see: https://tiddlywiki.com/#ListWidget
>>
>> $:/core/ui/PageTemplate/story tiddler contains the list-widget, which 
>> uses the content from $:/*config*/ui/ViewTemplate and $:/*config*
>> /ui/EditTemplate to define the defaults. 
>>
>> It's possible to "globally" set those templates by the user. ... but 
>> there is no "per tiddler" configuration atm. The "story" has no idea about 
>> the single tiddler content. 
>>
>> It's $:/core/ui/ViewTemplate that would need to be changed. The list 
>> there looks like this: 
>>
>> <$list 
>> filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" 
>> variable="listItem">
>>   <$transclude tiddler=<<listItem>>/>
>> </$list>
>>
>> If we change a part from the filter from tag[$:/tags/ViewTemplate] to 
>> eg: tag[$:/tags/myTemplate] based on a tiddler field, it should work 
>> "out of the box". ... Maybe ;)
>>
>> -m
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" 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/tiddlywikidev/9f53a797-a705-4586-913b-3b27554b08ab%40googlegroups.com.

Reply via email to